@ouro.bot/cli 0.1.0-alpha.657 → 0.1.0-alpha.659
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/README.md +13 -13
- package/changelog.json +15 -0
- package/dist/arc/evolution.js +1 -1
- package/dist/arc/flight-recorder.js +369 -0
- package/dist/arc/obligations.js +24 -2
- package/dist/heart/active-work.js +1 -1
- package/dist/heart/config-registry.js +5 -5
- package/dist/heart/context-loss-gauntlet.js +354 -0
- package/dist/heart/daemon/agent-config-check.js +1 -1
- package/dist/heart/daemon/agent-service.js +18 -17
- package/dist/heart/daemon/cli-exec.js +40 -12
- package/dist/heart/daemon/cli-help.js +21 -0
- package/dist/heart/daemon/cli-parse.js +27 -0
- package/dist/heart/daemon/daemon-entry.js +1 -1
- package/dist/heart/daemon/daemon.js +3 -3
- package/dist/heart/daemon/hooks/bundle-meta.js +29 -9
- package/dist/heart/daemon/inner-status.js +4 -15
- package/dist/heart/habits/habit-parser.js +64 -1
- package/dist/heart/hatch/hatch-flow.js +17 -9
- package/dist/heart/hatch/specialist-tools.js +15 -11
- package/dist/heart/kept-notes.js +5 -73
- package/dist/heart/mailbox/mailbox-http-hooks.js +1 -0
- package/dist/heart/mailbox/mailbox-http-routes.js +4 -0
- package/dist/heart/mailbox/mailbox-read.js +2 -1
- package/dist/heart/mailbox/readers/continuity-readers.js +5 -0
- package/dist/heart/mailbox/readers/runtime-readers.js +21 -49
- package/dist/heart/mcp/mcp-server.js +8 -8
- package/dist/heart/session-events.js +1 -31
- package/dist/heart/start-of-turn-packet.js +8 -2
- package/dist/heart/tool-description.js +15 -3
- package/dist/heart/turn-context.js +27 -7
- package/dist/heart/work-card.js +386 -0
- package/dist/mailbox-ui/assets/index-B-V9vRQ0.js +61 -0
- package/dist/mailbox-ui/assets/index-BOZbGbkL.css +1 -0
- package/dist/mailbox-ui/index.html +2 -2
- package/dist/mind/bundle-manifest.js +9 -3
- package/dist/mind/context.js +1 -2
- package/dist/mind/desk-section.js +53 -1
- package/dist/mind/diary.js +2 -3
- package/dist/mind/note-search.js +36 -106
- package/dist/mind/prompt.js +37 -102
- package/dist/mind/record-paths.js +312 -0
- package/dist/repertoire/bundle-templates.js +4 -5
- package/dist/repertoire/tools-bundle.js +1 -1
- package/dist/repertoire/tools-evolution.js +4 -4
- package/dist/repertoire/tools-notes.js +42 -62
- package/dist/repertoire/tools-record.js +16 -11
- package/dist/repertoire/tools-session.js +4 -4
- package/dist/repertoire/tools.js +1 -1
- package/dist/senses/habit-turn-message.js +19 -5
- package/dist/senses/inner-dialog-worker.js +58 -9
- package/dist/senses/inner-dialog.js +30 -11
- package/dist/senses/pipeline.js +135 -1
- package/dist/util/frontmatter.js +17 -1
- package/package.json +3 -3
- package/skills/configure-dev-tools.md +1 -1
- package/skills/travel-planning.md +1 -1
- package/dist/mailbox-ui/assets/index-9-AxCxuB.js +0 -61
- package/dist/mailbox-ui/assets/index-CWzt267f.css +0 -1
- package/dist/mind/journal-index.js +0 -162
package/dist/senses/pipeline.js
CHANGED
|
@@ -52,6 +52,8 @@ const socket_client_1 = require("../heart/daemon/socket-client");
|
|
|
52
52
|
const active_work_1 = require("../heart/active-work");
|
|
53
53
|
const delegation_1 = require("../heart/delegation");
|
|
54
54
|
const obligations_1 = require("../arc/obligations");
|
|
55
|
+
const packets_1 = require("../arc/packets");
|
|
56
|
+
const evolution_1 = require("../arc/evolution");
|
|
55
57
|
const provider_failover_1 = require("../heart/provider-failover");
|
|
56
58
|
const openai_codex_token_1 = require("../heart/providers/openai-codex-token");
|
|
57
59
|
const tempo_1 = require("../heart/tempo");
|
|
@@ -66,7 +68,16 @@ const episodes_1 = require("../arc/episodes");
|
|
|
66
68
|
const turn_context_1 = require("../heart/turn-context");
|
|
67
69
|
const provider_visibility_1 = require("../heart/provider-visibility");
|
|
68
70
|
const orientation_frame_1 = require("../heart/orientation-frame");
|
|
71
|
+
const flight_recorder_1 = require("../arc/flight-recorder");
|
|
69
72
|
const VOICE_PENDING_MAX_AGE_MS = 15 * 60 * 1_000;
|
|
73
|
+
const ACTIVE_FLIGHT_RECORDER_PACKET_STATUSES = new Set([
|
|
74
|
+
"drafting",
|
|
75
|
+
"processing",
|
|
76
|
+
"validating",
|
|
77
|
+
"collaborating",
|
|
78
|
+
"paused",
|
|
79
|
+
"blocked",
|
|
80
|
+
]);
|
|
70
81
|
function pendingExpirationReason(channel, message, now) {
|
|
71
82
|
/* v8 ignore start -- pending expiry edge permutations are covered by the stale voice queue tests; this helper keeps defensive non-voice fallbacks @preserve */
|
|
72
83
|
if (Number.isFinite(message.expiresAt) && Number(message.expiresAt) <= now)
|
|
@@ -198,6 +209,65 @@ function latestUserAuthoredText(messages, continuityIngressTexts) {
|
|
|
198
209
|
.filter(Boolean);
|
|
199
210
|
return userMessages[userMessages.length - 1];
|
|
200
211
|
}
|
|
212
|
+
function sessionRefForFlightRecorder(session) {
|
|
213
|
+
return `${session.friendId}/${session.channel}/${session.key}`;
|
|
214
|
+
}
|
|
215
|
+
function isTerminalWithoutContinuation(outcome, hasActiveContinuation) {
|
|
216
|
+
return !hasActiveContinuation && (outcome === "settled"
|
|
217
|
+
|| outcome === "observed"
|
|
218
|
+
|| outcome === "rested"
|
|
219
|
+
|| outcome === "superseded");
|
|
220
|
+
}
|
|
221
|
+
function readPostTurnFlightRecorderArcSnapshot(agentRoot) {
|
|
222
|
+
const latest = (0, flight_recorder_1.readFlightRecorderResume)(agentRoot);
|
|
223
|
+
return {
|
|
224
|
+
activeObligationIds: (0, obligations_1.readPendingObligations)(agentRoot).map((obligation) => obligation.id),
|
|
225
|
+
activeReturnObligationIds: (0, obligations_1.listActiveReturnObligationsForRoot)(agentRoot).map((obligation) => obligation.id),
|
|
226
|
+
activePacketIds: (0, packets_1.listPonderPackets)(agentRoot)
|
|
227
|
+
.filter((packet) => ACTIVE_FLIGHT_RECORDER_PACKET_STATUSES.has(packet.status))
|
|
228
|
+
.map((packet) => packet.id),
|
|
229
|
+
openEvolutionCaseIds: (0, evolution_1.listOpenEvolutionCases)(agentRoot).map((evolutionCase) => evolutionCase.id),
|
|
230
|
+
recentClaimIds: latest.recentClaimIds,
|
|
231
|
+
unverifiedClaimIds: latest.unverifiedClaimIds,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function recordPostTurnFlightRecorderCheckpoint(input) {
|
|
235
|
+
const hasActiveContinuation = input.mustResolveBeforeHandoff
|
|
236
|
+
|| input.activeObligationIds.length > 0
|
|
237
|
+
|| input.activeReturnObligationIds.length > 0
|
|
238
|
+
|| input.activePacketIds.length > 0
|
|
239
|
+
|| input.openEvolutionCaseIds.length > 0;
|
|
240
|
+
const blockedBecause = [
|
|
241
|
+
...(input.outcome === "blocked" ? ["agent reported a blocker in this turn"] : []),
|
|
242
|
+
...(input.outcome === "errored" ? ["turn errored before a safe continuation was reached"] : []),
|
|
243
|
+
...(input.outcome === "aborted" ? ["turn aborted before a safe continuation was reached"] : []),
|
|
244
|
+
...(isTerminalWithoutContinuation(input.outcome, hasActiveContinuation) ? [`turn outcome ${input.outcome}; wait for new input before acting`] : []),
|
|
245
|
+
];
|
|
246
|
+
const nextSafeAction = input.nextSafeAction
|
|
247
|
+
?? (blockedBecause.length > 0
|
|
248
|
+
? "inspect the latest session and wait for new input before acting"
|
|
249
|
+
: "continue the current held work and update Arc/Desk with the next checkpoint");
|
|
250
|
+
(0, flight_recorder_1.recordFlightRecorderEvent)(input.agentRoot, {
|
|
251
|
+
kind: "post_turn_persisted",
|
|
252
|
+
sessionRef: sessionRefForFlightRecorder(input.currentSession),
|
|
253
|
+
summary: `persisted ${input.currentSession.channel}/${input.currentSession.key} turn with outcome ${input.outcome}`,
|
|
254
|
+
currentAsk: input.currentAsk,
|
|
255
|
+
nextSafeAction,
|
|
256
|
+
blockedBecause,
|
|
257
|
+
stopBefore: blockedBecause.length > 0 ? ["acting on stale context"] : [],
|
|
258
|
+
activeObligationIds: input.activeObligationIds,
|
|
259
|
+
activeReturnObligationIds: input.activeReturnObligationIds,
|
|
260
|
+
activePacketIds: input.activePacketIds,
|
|
261
|
+
openEvolutionCaseIds: input.openEvolutionCaseIds,
|
|
262
|
+
recentClaimIds: input.recentClaimIds,
|
|
263
|
+
unverifiedClaimIds: input.unverifiedClaimIds,
|
|
264
|
+
meta: {
|
|
265
|
+
outcome: input.outcome,
|
|
266
|
+
mustResolveBeforeHandoff: input.mustResolveBeforeHandoff,
|
|
267
|
+
sessionPath: input.currentSession.sessionPath,
|
|
268
|
+
},
|
|
269
|
+
});
|
|
270
|
+
}
|
|
201
271
|
function resolveCurrentFailoverBinding(agentName, lane) {
|
|
202
272
|
const agentRoot = (0, identity_1.getAgentRoot)();
|
|
203
273
|
const { config: agentConfig } = (0, auth_flow_1.readAgentConfigForAgent)(agentName, path.dirname(agentRoot));
|
|
@@ -643,6 +713,7 @@ async function handleInboundTurn(input) {
|
|
|
643
713
|
all: activeWorkFrame.pendingObligations,
|
|
644
714
|
},
|
|
645
715
|
currentSessionTiming,
|
|
716
|
+
flightRecorderResume: ctx.flightRecorderResume,
|
|
646
717
|
});
|
|
647
718
|
/* v8 ignore next 3 -- syncFailure propagation tested in sync.test.ts @preserve */
|
|
648
719
|
if (syncFailure) {
|
|
@@ -708,7 +779,7 @@ async function handleInboundTurn(input) {
|
|
|
708
779
|
senseStatusLines: ctx.senseStatusLines,
|
|
709
780
|
bundleMeta: ctx.bundleMeta,
|
|
710
781
|
daemonHealth: ctx.daemonHealth,
|
|
711
|
-
|
|
782
|
+
flightRecorderResume: ctx.flightRecorderResume,
|
|
712
783
|
...(ctx.providerVisibility ? { providerVisibility: ctx.providerVisibility } : {}),
|
|
713
784
|
toolContext: {
|
|
714
785
|
/* v8 ignore next -- default no-op signin satisfies interface; real signin injected by sense adapter @preserve */
|
|
@@ -738,6 +809,36 @@ async function handleInboundTurn(input) {
|
|
|
738
809
|
result.error?.message ?? "unknown error", classification, currentProvider, currentBinding.model, agentName, inventory, {}, { currentLane });
|
|
739
810
|
input.failoverState.pending = failoverContext;
|
|
740
811
|
input.postTurn(sessionMessages, session.sessionPath, result.usage);
|
|
812
|
+
try {
|
|
813
|
+
const postTurnArc = readPostTurnFlightRecorderArcSnapshot((0, identity_1.getAgentRoot)());
|
|
814
|
+
recordPostTurnFlightRecorderCheckpoint({
|
|
815
|
+
agentRoot: (0, identity_1.getAgentRoot)(),
|
|
816
|
+
currentSession,
|
|
817
|
+
currentAsk: currentObligation
|
|
818
|
+
?? activeWorkFrame.primaryObligation?.content?.trim()
|
|
819
|
+
?? currentUserMessage
|
|
820
|
+
?? null,
|
|
821
|
+
nextSafeAction: failoverContext.userMessage,
|
|
822
|
+
outcome: "errored",
|
|
823
|
+
mustResolveBeforeHandoff,
|
|
824
|
+
activeObligationIds: postTurnArc.activeObligationIds,
|
|
825
|
+
activeReturnObligationIds: postTurnArc.activeReturnObligationIds,
|
|
826
|
+
activePacketIds: postTurnArc.activePacketIds,
|
|
827
|
+
openEvolutionCaseIds: postTurnArc.openEvolutionCaseIds,
|
|
828
|
+
recentClaimIds: postTurnArc.recentClaimIds,
|
|
829
|
+
unverifiedClaimIds: postTurnArc.unverifiedClaimIds,
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
catch (checkpointError) {
|
|
833
|
+
/* v8 ignore next -- best-effort recorder write must not hide provider-failover guidance @preserve */
|
|
834
|
+
(0, runtime_1.emitNervesEvent)({
|
|
835
|
+
level: "warn",
|
|
836
|
+
component: "senses",
|
|
837
|
+
event: "senses.flight_recorder_checkpoint_error",
|
|
838
|
+
message: "failed to record provider-failover flight recorder checkpoint",
|
|
839
|
+
meta: { error: checkpointError instanceof Error ? checkpointError.message : String(checkpointError) },
|
|
840
|
+
});
|
|
841
|
+
}
|
|
741
842
|
return {
|
|
742
843
|
resolvedContext,
|
|
743
844
|
gateResult,
|
|
@@ -781,6 +882,39 @@ async function handleInboundTurn(input) {
|
|
|
781
882
|
: undefined)
|
|
782
883
|
: (Object.keys(continuingState).length > 0 ? continuingState : undefined);
|
|
783
884
|
input.postTurn(sessionMessages, session.sessionPath, result.usage, undefined, nextState);
|
|
885
|
+
try {
|
|
886
|
+
const agentRoot = (0, identity_1.getAgentRoot)();
|
|
887
|
+
const postTurnArc = readPostTurnFlightRecorderArcSnapshot(agentRoot);
|
|
888
|
+
recordPostTurnFlightRecorderCheckpoint({
|
|
889
|
+
agentRoot,
|
|
890
|
+
currentSession,
|
|
891
|
+
currentAsk: currentObligation
|
|
892
|
+
?? activeWorkFrame.primaryObligation?.content?.trim()
|
|
893
|
+
?? currentUserMessage
|
|
894
|
+
?? null,
|
|
895
|
+
nextSafeAction: activeWorkFrame.resumeHandle?.nextAction
|
|
896
|
+
?? activeWorkFrame.primaryObligation?.nextAction?.trim()
|
|
897
|
+
?? null,
|
|
898
|
+
outcome: result.outcome ?? "observed",
|
|
899
|
+
mustResolveBeforeHandoff,
|
|
900
|
+
activeObligationIds: postTurnArc.activeObligationIds,
|
|
901
|
+
activeReturnObligationIds: postTurnArc.activeReturnObligationIds,
|
|
902
|
+
activePacketIds: postTurnArc.activePacketIds,
|
|
903
|
+
openEvolutionCaseIds: postTurnArc.openEvolutionCaseIds,
|
|
904
|
+
recentClaimIds: postTurnArc.recentClaimIds,
|
|
905
|
+
unverifiedClaimIds: postTurnArc.unverifiedClaimIds,
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
catch (error) {
|
|
909
|
+
/* v8 ignore next -- defensive recorder failures are non-fatal to already-persisted user turns @preserve */
|
|
910
|
+
(0, runtime_1.emitNervesEvent)({
|
|
911
|
+
level: "warn",
|
|
912
|
+
component: "senses",
|
|
913
|
+
event: "senses.flight_recorder_checkpoint_error",
|
|
914
|
+
message: "failed to record post-turn flight recorder checkpoint",
|
|
915
|
+
meta: { error: error instanceof Error ? error.message : String(error) },
|
|
916
|
+
});
|
|
917
|
+
}
|
|
784
918
|
// Step 7: Token accumulation
|
|
785
919
|
await input.accumulateFriendTokens(input.friendStore, resolvedContext.friend.id, result.usage);
|
|
786
920
|
(0, runtime_1.emitNervesEvent)({
|
package/dist/util/frontmatter.js
CHANGED
|
@@ -17,6 +17,10 @@ function parseScalar(raw) {
|
|
|
17
17
|
const value = raw.trim();
|
|
18
18
|
if (value === "null")
|
|
19
19
|
return null;
|
|
20
|
+
if (value === "true")
|
|
21
|
+
return true;
|
|
22
|
+
if (value === "false")
|
|
23
|
+
return false;
|
|
20
24
|
if (value === "[]")
|
|
21
25
|
return [];
|
|
22
26
|
if ((value.startsWith("\"") && value.endsWith("\"")) || (value.startsWith("'") && value.endsWith("'"))) {
|
|
@@ -46,7 +50,19 @@ function parseFrontmatter(raw) {
|
|
|
46
50
|
items.push(parseScalar(lines[cursor].replace(/^\s*-\s+/, "")));
|
|
47
51
|
cursor += 1;
|
|
48
52
|
}
|
|
49
|
-
|
|
53
|
+
if (items.length > 0) {
|
|
54
|
+
frontmatter[key] = items;
|
|
55
|
+
idx = cursor - 1;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const nested = {};
|
|
59
|
+
cursor = idx + 1;
|
|
60
|
+
while (cursor < lines.length && /^\s+[A-Za-z0-9_:-]+:\s*/.test(lines[cursor])) {
|
|
61
|
+
const child = /^\s+([A-Za-z0-9_:-]+):\s*(.*)$/.exec(lines[cursor]);
|
|
62
|
+
nested[child[1]] = parseScalar(child[2]);
|
|
63
|
+
cursor += 1;
|
|
64
|
+
}
|
|
65
|
+
frontmatter[key] = Object.keys(nested).length > 0 ? nested : items;
|
|
50
66
|
idx = cursor - 1;
|
|
51
67
|
}
|
|
52
68
|
return frontmatter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.659",
|
|
4
4
|
"main": "dist/heart/daemon/ouro-entry.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"cli": "dist/heart/daemon/ouro-bot-entry.js",
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
"@types/mailparser": "^3.4.6",
|
|
80
80
|
"@types/semver": "^7.7.1",
|
|
81
81
|
"@types/smtp-server": "^3.5.13",
|
|
82
|
-
"@vitest/coverage-v8": "^4.
|
|
82
|
+
"@vitest/coverage-v8": "^4.1.8",
|
|
83
83
|
"eslint": "^10.0.2",
|
|
84
84
|
"jsdom": "^29.0.2",
|
|
85
85
|
"typescript": "^5.7.0",
|
|
86
86
|
"typescript-eslint": "^8.56.1",
|
|
87
|
-
"vitest": "^4.
|
|
87
|
+
"vitest": "^4.1.8"
|
|
88
88
|
},
|
|
89
89
|
"overrides": {
|
|
90
90
|
"@microsoft/teams.apps": {
|
|
@@ -64,7 +64,7 @@ Once connected, these tools are available:
|
|
|
64
64
|
- **status** -- Get agent's current status and activity
|
|
65
65
|
- **catchup** -- Get recent activity summary
|
|
66
66
|
- **get_context** -- Get agent's current working context
|
|
67
|
-
- **
|
|
67
|
+
- **search_facts** -- Read-only Desk record fact search for specific topics; missing hits are not evidence that the agent has no belief or preference
|
|
68
68
|
- **get_task** -- Get details of the agent's current task
|
|
69
69
|
|
|
70
70
|
## Troubleshooting
|
|
@@ -92,7 +92,7 @@ an interactive sign-up flow.
|
|
|
92
92
|
|
|
93
93
|
### Post-Booking
|
|
94
94
|
- Save confirmation details (confirmation number, dates, hotel name, airline, booking reference)
|
|
95
|
-
- Save to diary
|
|
95
|
+
- Save durable travel facts to the Desk record diary or notes for future reference
|
|
96
96
|
- Set reminders for check-in windows
|
|
97
97
|
- Note cancellation deadlines
|
|
98
98
|
|