interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / docs / native / pi5-8 / orchestrator-exam / build_jsonl.sh

36 lines · 2299 bytes Raw Blame History
1#!/bin/bash
2# SPDX-License-Identifier: Apache-2.0
3# Copyright 2026 Drake Stapleton (AIEN / aien-dev)
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Derive machine-readable cases-<split>.jsonl (one JSON object per line) from the .psv sources, for the trainer and other readers.
18# Fields: id, split, category, decision_type (action|clarify|none|refuse), action, args ({"text":..} or {}),
19# arg_spans (for "text": start/end byte offsets into last_user, end exclusive, from a case-insensitive match; match=exact|case|none;
20# a text that is a shortened form of the request has no span and match=none), turns (all turns with roles), last_user.
21here=$(cd "$(dirname "$0")" && pwd)
22for split in train dev heldout; do
23 grep -v '^#' "$here/cases-$split.psv" | while IFS='|' read -r id cat act text turns; do
24 jq -cn --arg id "$id" --arg split "$split" --arg cat "$cat" --arg act "$act" --arg text "$text" --arg turns "$turns" '
25 ($turns|split(" ~~ ")) as $t | ($t|last) as $last
26 | (if $text=="" then null else ($last|index($text)) end) as $ex
27 | (if $text=="" then null else ($last|ascii_downcase|index($text|ascii_downcase)) end) as $ci
28 | {id:$id, split:$split, category:$cat,
29 decision_type:(if $act=="clarify" or $act=="none" or $act=="refuse" then $act else "action" end),
30 action:$act,
31 args:(if $text=="" then {} else {text:$text} end),
32 arg_spans:(if $text=="" then [] else [{arg:"text", start:($ex // $ci), end:(($ex // $ci) | if .==null then null else .+($text|length) end), match:(if $ex!=null then "exact" elif $ci!=null then "case" else "none" end)}] end),
33 turns:($t|to_entries|map({role:(if .key%2==0 then "user" else "assistant" end),content:.value})),
34 last_user:$last}'
35 done > "$here/cases-$split.jsonl"
36done