instar 1.2.57 → 1.2.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/autonomous/hooks/autonomous-stop-hook.sh +31 -0
- package/.claude/skills/autonomous/scripts/setup-autonomous.sh +25 -0
- package/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +21 -1
- package/dist/commands/server.js.map +1 -1
- package/dist/core/PostUpdateMigrator.js +2 -2
- package/dist/core/PostUpdateMigrator.js.map +1 -1
- package/dist/core/SessionManager.d.ts +6 -0
- package/dist/core/SessionManager.d.ts.map +1 -1
- package/dist/core/SessionManager.js +10 -0
- package/dist/core/SessionManager.js.map +1 -1
- package/dist/core/frameworkSessionLaunch.d.ts +34 -3
- package/dist/core/frameworkSessionLaunch.d.ts.map +1 -1
- package/dist/core/frameworkSessionLaunch.js +42 -3
- package/dist/core/frameworkSessionLaunch.js.map +1 -1
- package/dist/core/types.d.ts +12 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/server/CapabilityIndex.d.ts.map +1 -1
- package/dist/server/CapabilityIndex.js +2 -0
- package/dist/server/CapabilityIndex.js.map +1 -1
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +54 -0
- package/dist/server/routes.js.map +1 -1
- package/dist/threadline/PipeSessionSpawner.d.ts +10 -0
- package/dist/threadline/PipeSessionSpawner.d.ts.map +1 -1
- package/dist/threadline/PipeSessionSpawner.js +6 -0
- package/dist/threadline/PipeSessionSpawner.js.map +1 -1
- package/dist/threadline/ThreadlineBootstrap.d.ts.map +1 -1
- package/dist/threadline/ThreadlineBootstrap.js +5 -16
- package/dist/threadline/ThreadlineBootstrap.js.map +1 -1
- package/dist/threadline/mcpEntry.d.ts +25 -0
- package/dist/threadline/mcpEntry.d.ts.map +1 -0
- package/dist/threadline/mcpEntry.js +38 -0
- package/dist/threadline/mcpEntry.js.map +1 -0
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +62 -62
- package/upgrades/1.2.58.md +77 -0
- package/upgrades/1.2.59.md +67 -0
- package/upgrades/side-effects/codex-multiagent-threadline.md +69 -0
- package/upgrades/side-effects/goal-native-delegation.md +76 -0
|
@@ -146,6 +146,7 @@ DURATION_SECONDS=$(fm_get duration_seconds)
|
|
|
146
146
|
STARTED_AT=$(fm_get started_at)
|
|
147
147
|
COMPLETION_PROMISE=$(fm_get completion_promise)
|
|
148
148
|
COMPLETION_CONDITION=$(fm_get completion_condition)
|
|
149
|
+
GOAL_MODE=$(fm_get goal_mode) # "native" = the framework's own /goal loop drives completion
|
|
149
150
|
|
|
150
151
|
# Validate recorded session_id is a real UUID. Claude sometimes writes a custom
|
|
151
152
|
# string instead of $CLAUDE_CODE_SESSION_ID; non-UUID values are treated as
|
|
@@ -228,6 +229,36 @@ if [[ "$OWNER" != "true" ]]; then
|
|
|
228
229
|
exit 0
|
|
229
230
|
fi
|
|
230
231
|
|
|
232
|
+
# ── Native /goal delegation: the framework's own /goal loop owns completion. ──
|
|
233
|
+
# instar injected "/goal <condition>" at start (goal_mode=native), so we DEFER the
|
|
234
|
+
# continue/stop decision to native /goal's own Stop hook (we approve/exit; its hook
|
|
235
|
+
# blocks until the condition is met — block wins over approve, so it stays in control).
|
|
236
|
+
# instar still owns its terminal STOP concerns (emergency-stop, duration) and enforces
|
|
237
|
+
# them by CLEARING native /goal first (inject "/goal clear" via the server).
|
|
238
|
+
if [[ "$GOAL_MODE" == "native" ]]; then
|
|
239
|
+
native_goal_clear() {
|
|
240
|
+
local port auth
|
|
241
|
+
port=$(python3 -c "import json;print(json.load(open('.instar/config.json')).get('port',4040))" 2>/dev/null || echo 4040)
|
|
242
|
+
auth=$(python3 -c "import json;print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null || echo "")
|
|
243
|
+
jq -nc --arg t "$REPORT_TOPIC" '{topicId:$t}' \
|
|
244
|
+
| curl -s -m 10 -H "Authorization: Bearer $auth" -H 'Content-Type: application/json' \
|
|
245
|
+
--data-binary @- "http://localhost:${port}/autonomous/native-goal/clear" >/dev/null 2>&1 || true
|
|
246
|
+
}
|
|
247
|
+
if [[ -f ".instar/autonomous-emergency-stop" ]]; then
|
|
248
|
+
native_goal_clear; rm -f "$STATE_FILE"
|
|
249
|
+
echo "[autonomous] emergency stop — native /goal cleared" >&2; exit 0
|
|
250
|
+
fi
|
|
251
|
+
if [[ "$DURATION_SECONDS" =~ ^[0-9]+$ ]] && [[ $DURATION_SECONDS -gt 0 ]]; then
|
|
252
|
+
NG_START=$(date -u -j -f "%Y-%m-%dT%H:%M:%SZ" "$STARTED_AT" +%s 2>/dev/null || date -d "$STARTED_AT" +%s 2>/dev/null || echo 0)
|
|
253
|
+
if [[ "$NG_START" =~ ^[0-9]+$ ]] && [[ $NG_START -gt 0 ]] && [[ $(( $(date +%s) - NG_START )) -ge $DURATION_SECONDS ]]; then
|
|
254
|
+
native_goal_clear; rm -f "$STATE_FILE"
|
|
255
|
+
echo "[autonomous] duration expired — native /goal cleared" >&2; exit 0
|
|
256
|
+
fi
|
|
257
|
+
fi
|
|
258
|
+
# Not terminal → let native /goal decide completion. Approve (its hook keeps control).
|
|
259
|
+
exit 0
|
|
260
|
+
fi
|
|
261
|
+
|
|
231
262
|
# ── This IS the autonomous session. Terminal checks first. ────────────
|
|
232
263
|
|
|
233
264
|
# Validate iteration
|
|
@@ -197,6 +197,31 @@ To complete, ALL of these must be true:
|
|
|
197
197
|
- Then output: <promise>$COMPLETION_PROMISE</promise>
|
|
198
198
|
EOF
|
|
199
199
|
|
|
200
|
+
# ── Native /goal delegation: where the framework has a native /goal loop, hand the
|
|
201
|
+
# condition to it (instar injects "/goal <condition>" via the server → SessionManager
|
|
202
|
+
# send-keys) and mark goal_mode:native so the stop-hook defers completion to it. Only
|
|
203
|
+
# with a condition + a per-topic job + Claude Code >= 2.1.139. Best-effort: on any miss
|
|
204
|
+
# we leave goal_mode empty and instar's own independent evaluator drives (Phase 1).
|
|
205
|
+
if [[ -n "$COMPLETION_CONDITION" ]] && [[ -n "$REPORT_TOPIC" ]]; then
|
|
206
|
+
CLAUDE_VER=$(claude --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || echo "")
|
|
207
|
+
NATIVE_GOAL_OK="false"
|
|
208
|
+
if [[ -n "$CLAUDE_VER" ]]; then
|
|
209
|
+
# /goal requires Claude Code >= 2.1.139.
|
|
210
|
+
if [[ "$(printf '%s\n2.1.139\n' "$CLAUDE_VER" | sort -V | head -1)" == "2.1.139" ]]; then
|
|
211
|
+
NATIVE_GOAL_OK="true"
|
|
212
|
+
fi
|
|
213
|
+
fi
|
|
214
|
+
if [[ "$NATIVE_GOAL_OK" == "true" ]]; then
|
|
215
|
+
NG_PORT=$(python3 -c "import json;print(json.load(open('.instar/config.json')).get('port',4040))" 2>/dev/null || echo 4040)
|
|
216
|
+
NG_AUTH=$(python3 -c "import json;print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null || echo "")
|
|
217
|
+
jq -nc --arg t "$REPORT_TOPIC" --arg c "$COMPLETION_CONDITION" '{topicId:$t,condition:$c}' \
|
|
218
|
+
| curl -s -m 8 -H "Authorization: Bearer $NG_AUTH" -H 'Content-Type: application/json' \
|
|
219
|
+
--data-binary @- "http://localhost:${NG_PORT}/autonomous/native-goal/set" >/dev/null 2>&1 \
|
|
220
|
+
&& echo " Native /goal: handed condition to Claude Code's /goal loop" \
|
|
221
|
+
|| echo " Native /goal: unavailable — using instar's own completion evaluator"
|
|
222
|
+
fi
|
|
223
|
+
fi
|
|
224
|
+
|
|
200
225
|
echo "🔄 Autonomous mode activated!"
|
|
201
226
|
echo ""
|
|
202
227
|
echo "Goal: $GOAL"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsQH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAiqDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA0zLtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
|
package/dist/commands/server.js
CHANGED
|
@@ -91,6 +91,7 @@ import { pickupGitSyncMessages } from '../messaging/GitSyncTransport.js';
|
|
|
91
91
|
import { DeliveryRetryManager } from '../messaging/DeliveryRetryManager.js';
|
|
92
92
|
import { SpawnRequestManager } from '../messaging/SpawnRequestManager.js';
|
|
93
93
|
import { ThreadlineRouter } from '../threadline/ThreadlineRouter.js';
|
|
94
|
+
import { resolveThreadlineMcpEntry } from '../threadline/mcpEntry.js';
|
|
94
95
|
import { ThreadResumeMap } from '../threadline/ThreadResumeMap.js';
|
|
95
96
|
import { ListenerSessionManager } from '../threadline/ListenerSessionManager.js';
|
|
96
97
|
import { SystemReviewer } from '../monitoring/SystemReviewer.js';
|
|
@@ -2116,7 +2117,17 @@ export async function startServer(options) {
|
|
|
2116
2117
|
console.log(pc.yellow(` Git sync setup: ${err instanceof Error ? err.message : String(err)}`));
|
|
2117
2118
|
}
|
|
2118
2119
|
}
|
|
2119
|
-
|
|
2120
|
+
// Per-agent Codex threadline MCP override. Codex reads a SHARED
|
|
2121
|
+
// ~/.codex/config.toml whose [mcp_servers."threadline"] is last-writer-wins
|
|
2122
|
+
// across every codex agent on the machine — so a codex worker could load a
|
|
2123
|
+
// DIFFERENT agent's threadline identity and its threadline_send would be
|
|
2124
|
+
// misaddressed. Pin this agent's own entry per-spawn (the launch builders
|
|
2125
|
+
// emit `-c mcp_servers.threadline.*`). Only when threadline is configured;
|
|
2126
|
+
// ignored by non-codex launches. See CODEX-MULTIAGENT-THREADLINE-SPEC.
|
|
2127
|
+
const codexThreadlineMcp = config.threadline
|
|
2128
|
+
? resolveThreadlineMcpEntry(config.sessions.projectDir, config.stateDir, config.projectName)
|
|
2129
|
+
: undefined;
|
|
2130
|
+
const sessionManager = new SessionManager(codexThreadlineMcp ? { ...config.sessions, codexThreadlineMcp } : config.sessions, state);
|
|
2120
2131
|
// Input Guard is constructed later (after sharedIntelligence is available)
|
|
2121
2132
|
// so the topic coherence reviewer can route through the IntelligenceProvider
|
|
2122
2133
|
// abstraction instead of calling Anthropic directly.
|
|
@@ -5970,6 +5981,12 @@ export async function startServer(options) {
|
|
|
5970
5981
|
// §4.5: honor SpawnRequestManager's provenance tag so drain-spawned
|
|
5971
5982
|
// sessions are distinguishable from inline-spawned ones in logs/stream.
|
|
5972
5983
|
triggeredBy: opts?.triggeredBy ?? 'spawn-request',
|
|
5984
|
+
// This is the Threadline inbound-reply spawn: the worker must call
|
|
5985
|
+
// the threadline_send MCP tool to reply, which a codex worker can only
|
|
5986
|
+
// do under full bypass (codex cancels MCP calls in any sandbox). Jobs
|
|
5987
|
+
// do NOT set this and stay sandboxed. Bounded: Threadline only accepts
|
|
5988
|
+
// messages from trusted agents.
|
|
5989
|
+
codexAllowMcpTools: true,
|
|
5973
5990
|
});
|
|
5974
5991
|
return session.id;
|
|
5975
5992
|
},
|
|
@@ -6160,6 +6177,9 @@ export async function startServer(options) {
|
|
|
6160
6177
|
minIqsBand: pipeConfig?.minIqsBand ?? 70,
|
|
6161
6178
|
framework: pipeFramework,
|
|
6162
6179
|
binaryPath: pipeBinaryPath,
|
|
6180
|
+
// Same per-agent codex threadline MCP override as SessionManager, so a
|
|
6181
|
+
// codex pipe-reply worker uses THIS agent's threadline MCP.
|
|
6182
|
+
...(codexThreadlineMcp ? { codexThreadlineMcp } : {}),
|
|
6163
6183
|
});
|
|
6164
6184
|
console.log(pc.dim(` Pipe sessions: enabled (model: ${pipeConfig?.model ?? 'sonnet'}, max: ${pipeConfig?.maxConcurrent ?? 5})`));
|
|
6165
6185
|
}
|