@ouro.bot/cli 0.1.0-alpha.7 → 0.1.0-alpha.71
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/AdoptionSpecialist.ouro/agent.json +70 -9
- package/AdoptionSpecialist.ouro/psyche/SOUL.md +5 -2
- package/AdoptionSpecialist.ouro/psyche/identities/monty.md +2 -2
- package/README.md +147 -205
- package/assets/ouroboros.png +0 -0
- package/changelog.json +395 -0
- package/dist/heart/active-work.js +178 -0
- package/dist/heart/bridges/manager.js +358 -0
- package/dist/heart/bridges/state-machine.js +135 -0
- package/dist/heart/bridges/store.js +123 -0
- package/dist/heart/config.js +68 -23
- package/dist/heart/core.js +282 -92
- package/dist/heart/cross-chat-delivery.js +146 -0
- package/dist/heart/daemon/agent-discovery.js +81 -0
- package/dist/heart/daemon/auth-flow.js +409 -0
- package/dist/heart/daemon/daemon-cli.js +1408 -248
- package/dist/heart/daemon/daemon-entry.js +55 -6
- package/dist/heart/daemon/daemon-runtime-sync.js +212 -0
- package/dist/heart/daemon/daemon.js +216 -10
- package/dist/heart/daemon/hatch-animation.js +10 -3
- package/dist/heart/daemon/hatch-flow.js +7 -82
- package/dist/heart/daemon/hooks/bundle-meta.js +92 -0
- package/dist/heart/daemon/launchd.js +159 -0
- package/dist/heart/daemon/log-tailer.js +4 -3
- package/dist/heart/daemon/message-router.js +17 -8
- package/dist/heart/daemon/ouro-bot-entry.js +0 -0
- package/dist/heart/daemon/ouro-bot-global-installer.js +128 -0
- package/dist/heart/daemon/ouro-entry.js +0 -0
- package/dist/heart/daemon/ouro-path-installer.js +178 -0
- package/dist/heart/daemon/ouro-uti.js +11 -2
- package/dist/heart/daemon/process-manager.js +14 -1
- package/dist/heart/daemon/run-hooks.js +37 -0
- package/dist/heart/daemon/runtime-logging.js +58 -15
- package/dist/heart/daemon/runtime-metadata.js +219 -0
- package/dist/heart/daemon/runtime-mode.js +67 -0
- package/dist/heart/daemon/sense-manager.js +307 -0
- package/dist/heart/daemon/skill-management-installer.js +94 -0
- package/dist/heart/daemon/socket-client.js +202 -0
- package/dist/heart/daemon/specialist-orchestrator.js +53 -84
- package/dist/heart/daemon/specialist-prompt.js +64 -5
- package/dist/heart/daemon/specialist-tools.js +213 -58
- package/dist/heart/daemon/staged-restart.js +114 -0
- package/dist/heart/daemon/thoughts.js +379 -0
- package/dist/heart/daemon/update-checker.js +111 -0
- package/dist/heart/daemon/update-hooks.js +138 -0
- package/dist/heart/daemon/wrapper-publish-guard.js +86 -0
- package/dist/heart/delegation.js +62 -0
- package/dist/heart/identity.js +126 -21
- package/dist/heart/kicks.js +1 -19
- package/dist/heart/model-capabilities.js +48 -0
- package/dist/heart/progress-story.js +42 -0
- package/dist/heart/providers/anthropic.js +74 -9
- package/dist/heart/providers/azure.js +86 -7
- package/dist/heart/providers/github-copilot.js +149 -0
- package/dist/heart/providers/minimax.js +4 -0
- package/dist/heart/providers/openai-codex.js +12 -3
- package/dist/heart/safe-workspace.js +228 -0
- package/dist/heart/sense-truth.js +61 -0
- package/dist/heart/session-activity.js +169 -0
- package/dist/heart/session-recall.js +116 -0
- package/dist/heart/streaming.js +100 -22
- package/dist/heart/target-resolution.js +123 -0
- package/dist/heart/turn-coordinator.js +28 -0
- package/dist/mind/associative-recall.js +14 -2
- package/dist/mind/bundle-manifest.js +70 -0
- package/dist/mind/context.js +27 -11
- package/dist/mind/first-impressions.js +16 -2
- package/dist/mind/friends/channel.js +35 -0
- package/dist/mind/friends/group-context.js +144 -0
- package/dist/mind/friends/store-file.js +19 -0
- package/dist/mind/friends/trust-explanation.js +74 -0
- package/dist/mind/friends/types.js +8 -0
- package/dist/mind/memory.js +27 -26
- package/dist/mind/pending.js +72 -9
- package/dist/mind/phrases.js +1 -0
- package/dist/mind/prompt.js +358 -77
- package/dist/mind/token-estimate.js +8 -12
- package/dist/nerves/cli-logging.js +15 -2
- package/dist/nerves/coverage/run-artifacts.js +1 -1
- package/dist/repertoire/ado-client.js +4 -2
- package/dist/repertoire/coding/feedback.js +134 -0
- package/dist/repertoire/coding/index.js +4 -1
- package/dist/repertoire/coding/manager.js +62 -4
- package/dist/repertoire/coding/spawner.js +3 -3
- package/dist/repertoire/coding/tools.js +41 -2
- package/dist/repertoire/data/ado-endpoints.json +188 -0
- package/dist/repertoire/guardrails.js +279 -0
- package/dist/repertoire/mcp-client.js +254 -0
- package/dist/repertoire/mcp-manager.js +195 -0
- package/dist/repertoire/skills.js +3 -26
- package/dist/repertoire/tasks/board.js +12 -0
- package/dist/repertoire/tasks/index.js +23 -9
- package/dist/repertoire/tasks/transitions.js +1 -2
- package/dist/repertoire/tools-base.js +642 -251
- package/dist/repertoire/tools-bluebubbles.js +93 -0
- package/dist/repertoire/tools-teams.js +58 -25
- package/dist/repertoire/tools.js +93 -52
- package/dist/senses/bluebubbles-client.js +210 -5
- package/dist/senses/bluebubbles-entry.js +2 -0
- package/dist/senses/bluebubbles-inbound-log.js +109 -0
- package/dist/senses/bluebubbles-media.js +339 -0
- package/dist/senses/bluebubbles-model.js +12 -4
- package/dist/senses/bluebubbles-mutation-log.js +45 -5
- package/dist/senses/bluebubbles-runtime-state.js +109 -0
- package/dist/senses/bluebubbles-session-cleanup.js +72 -0
- package/dist/senses/bluebubbles.js +893 -45
- package/dist/senses/cli-layout.js +87 -0
- package/dist/senses/cli.js +348 -144
- package/dist/senses/continuity.js +94 -0
- package/dist/senses/debug-activity.js +148 -0
- package/dist/senses/inner-dialog-worker.js +47 -18
- package/dist/senses/inner-dialog.js +333 -84
- package/dist/senses/pipeline.js +278 -0
- package/dist/senses/teams.js +573 -129
- package/dist/senses/trust-gate.js +112 -2
- package/package.json +14 -3
- package/subagents/README.md +4 -70
- package/dist/heart/daemon/specialist-session.js +0 -142
- package/dist/heart/daemon/subagent-installer.js +0 -125
- package/dist/inner-worker-entry.js +0 -4
- package/subagents/work-doer.md +0 -233
- package/subagents/work-merger.md +0 -624
- package/subagents/work-planner.md +0 -373
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.registerUpdateHook = registerUpdateHook;
|
|
37
|
+
exports.getRegisteredHooks = getRegisteredHooks;
|
|
38
|
+
exports.clearRegisteredHooks = clearRegisteredHooks;
|
|
39
|
+
exports.applyPendingUpdates = applyPendingUpdates;
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const semver = __importStar(require("semver"));
|
|
43
|
+
const runtime_1 = require("../../nerves/runtime");
|
|
44
|
+
const _hooks = [];
|
|
45
|
+
function registerUpdateHook(hook) {
|
|
46
|
+
_hooks.push(hook);
|
|
47
|
+
(0, runtime_1.emitNervesEvent)({
|
|
48
|
+
component: "daemon",
|
|
49
|
+
event: "daemon.update_hook_registered",
|
|
50
|
+
message: "registered update hook",
|
|
51
|
+
meta: {},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function getRegisteredHooks() {
|
|
55
|
+
return _hooks;
|
|
56
|
+
}
|
|
57
|
+
function clearRegisteredHooks() {
|
|
58
|
+
_hooks.length = 0;
|
|
59
|
+
}
|
|
60
|
+
async function applyPendingUpdates(bundlesRoot, currentVersion) {
|
|
61
|
+
const summary = { updated: [] };
|
|
62
|
+
(0, runtime_1.emitNervesEvent)({
|
|
63
|
+
component: "daemon",
|
|
64
|
+
event: "daemon.apply_pending_updates_start",
|
|
65
|
+
message: "applying pending updates",
|
|
66
|
+
meta: { bundlesRoot, currentVersion },
|
|
67
|
+
});
|
|
68
|
+
if (!fs.existsSync(bundlesRoot)) {
|
|
69
|
+
return summary;
|
|
70
|
+
}
|
|
71
|
+
let entries;
|
|
72
|
+
try {
|
|
73
|
+
entries = fs.readdirSync(bundlesRoot, { withFileTypes: true });
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return summary;
|
|
77
|
+
}
|
|
78
|
+
for (const entry of entries) {
|
|
79
|
+
if (!entry.isDirectory() || !entry.name.endsWith(".ouro"))
|
|
80
|
+
continue;
|
|
81
|
+
const agentRoot = path.join(bundlesRoot, entry.name);
|
|
82
|
+
let previousVersion;
|
|
83
|
+
const metaPath = path.join(agentRoot, "bundle-meta.json");
|
|
84
|
+
try {
|
|
85
|
+
if (fs.existsSync(metaPath)) {
|
|
86
|
+
const raw = fs.readFileSync(metaPath, "utf-8");
|
|
87
|
+
const meta = JSON.parse(raw);
|
|
88
|
+
previousVersion = meta.runtimeVersion;
|
|
89
|
+
if (previousVersion === currentVersion) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
// Skip downgrades — only update forward
|
|
93
|
+
if (semver.valid(previousVersion) && semver.valid(currentVersion) && semver.gte(previousVersion, currentVersion)) {
|
|
94
|
+
(0, runtime_1.emitNervesEvent)({
|
|
95
|
+
component: "daemon",
|
|
96
|
+
event: "daemon.update_hook_skip_downgrade",
|
|
97
|
+
message: "skipping downgrade",
|
|
98
|
+
meta: { agentRoot, previousVersion, currentVersion },
|
|
99
|
+
});
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
// Malformed or unreadable bundle-meta.json -- treat as needing update
|
|
106
|
+
previousVersion = undefined;
|
|
107
|
+
}
|
|
108
|
+
const ctx = { agentRoot, currentVersion, previousVersion };
|
|
109
|
+
for (const hook of _hooks) {
|
|
110
|
+
try {
|
|
111
|
+
await hook(ctx);
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
(0, runtime_1.emitNervesEvent)({
|
|
115
|
+
component: "daemon",
|
|
116
|
+
event: "daemon.update_hook_error",
|
|
117
|
+
message: "update hook threw",
|
|
118
|
+
meta: {
|
|
119
|
+
agentRoot,
|
|
120
|
+
error: err instanceof Error ? err.message : /* v8 ignore next -- defensive: non-Error catch branch @preserve */ String(err),
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
summary.updated.push({
|
|
126
|
+
agent: entry.name.replace(/\.ouro$/, ""),
|
|
127
|
+
from: previousVersion,
|
|
128
|
+
to: currentVersion,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
(0, runtime_1.emitNervesEvent)({
|
|
132
|
+
component: "daemon",
|
|
133
|
+
event: "daemon.apply_pending_updates_end",
|
|
134
|
+
message: "pending updates applied",
|
|
135
|
+
meta: { bundlesRoot },
|
|
136
|
+
});
|
|
137
|
+
return summary;
|
|
138
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assessWrapperPublishSync = assessWrapperPublishSync;
|
|
4
|
+
const runtime_1 = require("../../nerves/runtime");
|
|
5
|
+
function wrapperPackageChanged(changedFiles) {
|
|
6
|
+
return changedFiles.some((file) => file.startsWith("packages/ouro.bot/"));
|
|
7
|
+
}
|
|
8
|
+
function assessWrapperPublishSync(input) {
|
|
9
|
+
let result;
|
|
10
|
+
if (input.localVersion !== input.cliVersion) {
|
|
11
|
+
result = {
|
|
12
|
+
ok: false,
|
|
13
|
+
message: `ouro.bot wrapper version ${input.localVersion} must match @ouro.bot/cli version ${input.cliVersion}`,
|
|
14
|
+
};
|
|
15
|
+
(0, runtime_1.emitNervesEvent)({
|
|
16
|
+
level: "warn",
|
|
17
|
+
component: "daemon",
|
|
18
|
+
event: "daemon.wrapper_publish_guard_checked",
|
|
19
|
+
message: "evaluated wrapper publish sync",
|
|
20
|
+
meta: {
|
|
21
|
+
changed: wrapperPackageChanged(input.changedFiles),
|
|
22
|
+
localVersion: input.localVersion,
|
|
23
|
+
cliVersion: input.cliVersion,
|
|
24
|
+
publishedVersion: input.publishedVersion,
|
|
25
|
+
ok: result.ok,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
if (!wrapperPackageChanged(input.changedFiles)) {
|
|
31
|
+
result = {
|
|
32
|
+
ok: true,
|
|
33
|
+
message: "wrapper package unchanged",
|
|
34
|
+
};
|
|
35
|
+
(0, runtime_1.emitNervesEvent)({
|
|
36
|
+
component: "daemon",
|
|
37
|
+
event: "daemon.wrapper_publish_guard_checked",
|
|
38
|
+
message: "evaluated wrapper publish sync",
|
|
39
|
+
meta: {
|
|
40
|
+
changed: false,
|
|
41
|
+
localVersion: input.localVersion,
|
|
42
|
+
cliVersion: input.cliVersion,
|
|
43
|
+
publishedVersion: input.publishedVersion,
|
|
44
|
+
ok: result.ok,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
if (input.publishedVersion === input.localVersion) {
|
|
50
|
+
result = {
|
|
51
|
+
ok: false,
|
|
52
|
+
message: `ouro.bot wrapper changed but ouro.bot@${input.localVersion} is already published; bump packages/ouro.bot/package.json before merging`,
|
|
53
|
+
};
|
|
54
|
+
(0, runtime_1.emitNervesEvent)({
|
|
55
|
+
level: "warn",
|
|
56
|
+
component: "daemon",
|
|
57
|
+
event: "daemon.wrapper_publish_guard_checked",
|
|
58
|
+
message: "evaluated wrapper publish sync",
|
|
59
|
+
meta: {
|
|
60
|
+
changed: true,
|
|
61
|
+
localVersion: input.localVersion,
|
|
62
|
+
cliVersion: input.cliVersion,
|
|
63
|
+
publishedVersion: input.publishedVersion,
|
|
64
|
+
ok: result.ok,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
result = {
|
|
70
|
+
ok: true,
|
|
71
|
+
message: "wrapper package changed and local wrapper version is unpublished",
|
|
72
|
+
};
|
|
73
|
+
(0, runtime_1.emitNervesEvent)({
|
|
74
|
+
component: "daemon",
|
|
75
|
+
event: "daemon.wrapper_publish_guard_checked",
|
|
76
|
+
message: "evaluated wrapper publish sync",
|
|
77
|
+
meta: {
|
|
78
|
+
changed: true,
|
|
79
|
+
localVersion: input.localVersion,
|
|
80
|
+
cliVersion: input.cliVersion,
|
|
81
|
+
publishedVersion: input.publishedVersion,
|
|
82
|
+
ok: result.ok,
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decideDelegation = decideDelegation;
|
|
4
|
+
const runtime_1 = require("../nerves/runtime");
|
|
5
|
+
const CROSS_SESSION_TOOLS = new Set(["query_session", "send_message", "bridge_manage"]);
|
|
6
|
+
const FAST_PATH_TOOLS = new Set(["final_answer"]);
|
|
7
|
+
const REFLECTION_PATTERN = /\b(think|reflect|ponder|surface|surfaces|surfaced|sit with|metaboli[sz]e)\b/i;
|
|
8
|
+
const CROSS_SESSION_PATTERN = /\b(other chat|other session|across chats?|across sessions?|keep .* aligned|relay|carry .* across)\b/i;
|
|
9
|
+
function hasExplicitReflection(ingressTexts) {
|
|
10
|
+
return ingressTexts.some((text) => REFLECTION_PATTERN.test(text));
|
|
11
|
+
}
|
|
12
|
+
function hasCrossSessionPressure(ingressTexts, requestedToolNames) {
|
|
13
|
+
if (requestedToolNames.some((name) => CROSS_SESSION_TOOLS.has(name))) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
return ingressTexts.some((text) => CROSS_SESSION_PATTERN.test(text));
|
|
17
|
+
}
|
|
18
|
+
function hasNonFastPathToolRequest(requestedToolNames) {
|
|
19
|
+
return requestedToolNames.some((name) => !FAST_PATH_TOOLS.has(name));
|
|
20
|
+
}
|
|
21
|
+
function decideDelegation(input) {
|
|
22
|
+
const requestedToolNames = (input.requestedToolNames ?? [])
|
|
23
|
+
.map((name) => name.trim())
|
|
24
|
+
.filter((name) => name.length > 0);
|
|
25
|
+
const reasons = [];
|
|
26
|
+
if (hasExplicitReflection(input.ingressTexts)) {
|
|
27
|
+
reasons.push("explicit_reflection");
|
|
28
|
+
}
|
|
29
|
+
if (hasCrossSessionPressure(input.ingressTexts, requestedToolNames)) {
|
|
30
|
+
reasons.push("cross_session");
|
|
31
|
+
}
|
|
32
|
+
if (input.activeWork.centerOfGravity === "shared-work" || input.activeWork.bridges.some((bridge) => bridge.lifecycle === "active")) {
|
|
33
|
+
reasons.push("bridge_state");
|
|
34
|
+
}
|
|
35
|
+
if (input.activeWork.taskPressure.liveTaskNames.length > 0) {
|
|
36
|
+
reasons.push("task_state");
|
|
37
|
+
}
|
|
38
|
+
if (hasNonFastPathToolRequest(requestedToolNames)) {
|
|
39
|
+
reasons.push("non_fast_path_tool");
|
|
40
|
+
}
|
|
41
|
+
if (input.mustResolveBeforeHandoff || input.activeWork.mustResolveBeforeHandoff) {
|
|
42
|
+
reasons.push("unresolved_obligation");
|
|
43
|
+
}
|
|
44
|
+
const target = reasons.length === 0 ? "fast-path" : "delegate-inward";
|
|
45
|
+
const decision = {
|
|
46
|
+
target,
|
|
47
|
+
reasons,
|
|
48
|
+
outwardClosureRequired: target === "delegate-inward" && input.channel !== "inner",
|
|
49
|
+
};
|
|
50
|
+
(0, runtime_1.emitNervesEvent)({
|
|
51
|
+
component: "engine",
|
|
52
|
+
event: "engine.delegation_decide",
|
|
53
|
+
message: "computed delegation hint",
|
|
54
|
+
meta: {
|
|
55
|
+
channel: input.channel,
|
|
56
|
+
target: decision.target,
|
|
57
|
+
reasons: decision.reasons,
|
|
58
|
+
outwardClosureRequired: decision.outwardClosureRequired,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
return decision;
|
|
62
|
+
}
|
package/dist/heart/identity.js
CHANGED
|
@@ -33,16 +33,24 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.DEFAULT_AGENT_PHRASES = exports.DEFAULT_AGENT_CONTEXT = void 0;
|
|
36
|
+
exports.HARNESS_CANONICAL_REPO_URL = exports.DEFAULT_AGENT_SENSES = exports.DEFAULT_AGENT_PHRASES = exports.DEFAULT_AGENT_CONTEXT = void 0;
|
|
37
37
|
exports.buildDefaultAgentTemplate = buildDefaultAgentTemplate;
|
|
38
38
|
exports.getAgentName = getAgentName;
|
|
39
39
|
exports.getRepoRoot = getRepoRoot;
|
|
40
40
|
exports.getAgentBundlesRoot = getAgentBundlesRoot;
|
|
41
41
|
exports.getAgentRoot = getAgentRoot;
|
|
42
|
+
exports.getAgentStateRoot = getAgentStateRoot;
|
|
43
|
+
exports.getAgentRepoWorkspacesRoot = getAgentRepoWorkspacesRoot;
|
|
44
|
+
exports.getAgentDaemonStateRoot = getAgentDaemonStateRoot;
|
|
45
|
+
exports.getAgentDaemonLogsDir = getAgentDaemonLogsDir;
|
|
46
|
+
exports.getAgentDaemonLoggingConfigPath = getAgentDaemonLoggingConfigPath;
|
|
47
|
+
exports.getAgentMessagesRoot = getAgentMessagesRoot;
|
|
48
|
+
exports.getAgentToolsRoot = getAgentToolsRoot;
|
|
42
49
|
exports.getAgentSecretsPath = getAgentSecretsPath;
|
|
43
50
|
exports.loadAgentConfig = loadAgentConfig;
|
|
44
51
|
exports.setAgentName = setAgentName;
|
|
45
52
|
exports.setAgentConfigOverride = setAgentConfigOverride;
|
|
53
|
+
exports.resetAgentConfigCache = resetAgentConfigCache;
|
|
46
54
|
exports.resetIdentity = resetIdentity;
|
|
47
55
|
const fs = __importStar(require("fs"));
|
|
48
56
|
const os = __importStar(require("os"));
|
|
@@ -57,12 +65,73 @@ exports.DEFAULT_AGENT_PHRASES = {
|
|
|
57
65
|
tool: ["running tool"],
|
|
58
66
|
followup: ["processing"],
|
|
59
67
|
};
|
|
68
|
+
exports.DEFAULT_AGENT_SENSES = {
|
|
69
|
+
cli: { enabled: true },
|
|
70
|
+
teams: { enabled: false },
|
|
71
|
+
bluebubbles: { enabled: false },
|
|
72
|
+
};
|
|
73
|
+
function normalizeSenses(value, configFile) {
|
|
74
|
+
const defaults = {
|
|
75
|
+
cli: { ...exports.DEFAULT_AGENT_SENSES.cli },
|
|
76
|
+
teams: { ...exports.DEFAULT_AGENT_SENSES.teams },
|
|
77
|
+
bluebubbles: { ...exports.DEFAULT_AGENT_SENSES.bluebubbles },
|
|
78
|
+
};
|
|
79
|
+
if (value === undefined) {
|
|
80
|
+
return defaults;
|
|
81
|
+
}
|
|
82
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
83
|
+
(0, runtime_1.emitNervesEvent)({
|
|
84
|
+
level: "error",
|
|
85
|
+
event: "config_identity.error",
|
|
86
|
+
component: "config/identity",
|
|
87
|
+
message: "agent config has invalid senses block",
|
|
88
|
+
meta: { path: configFile },
|
|
89
|
+
});
|
|
90
|
+
throw new Error(`agent.json at ${configFile} must include senses as an object when present.`);
|
|
91
|
+
}
|
|
92
|
+
const raw = value;
|
|
93
|
+
const senseNames = ["cli", "teams", "bluebubbles"];
|
|
94
|
+
for (const senseName of senseNames) {
|
|
95
|
+
const rawSense = raw[senseName];
|
|
96
|
+
if (rawSense === undefined) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (!rawSense || typeof rawSense !== "object" || Array.isArray(rawSense)) {
|
|
100
|
+
(0, runtime_1.emitNervesEvent)({
|
|
101
|
+
level: "error",
|
|
102
|
+
event: "config_identity.error",
|
|
103
|
+
component: "config/identity",
|
|
104
|
+
message: "agent config has invalid sense config",
|
|
105
|
+
meta: { path: configFile, sense: senseName },
|
|
106
|
+
});
|
|
107
|
+
throw new Error(`agent.json at ${configFile} has invalid senses.${senseName} config.`);
|
|
108
|
+
}
|
|
109
|
+
const enabled = rawSense.enabled;
|
|
110
|
+
if (typeof enabled !== "boolean") {
|
|
111
|
+
(0, runtime_1.emitNervesEvent)({
|
|
112
|
+
level: "error",
|
|
113
|
+
event: "config_identity.error",
|
|
114
|
+
component: "config/identity",
|
|
115
|
+
message: "agent config has invalid sense enabled flag",
|
|
116
|
+
meta: { path: configFile, sense: senseName, enabled: enabled ?? null },
|
|
117
|
+
});
|
|
118
|
+
throw new Error(`agent.json at ${configFile} must include senses.${senseName}.enabled as boolean.`);
|
|
119
|
+
}
|
|
120
|
+
defaults[senseName] = { enabled };
|
|
121
|
+
}
|
|
122
|
+
return defaults;
|
|
123
|
+
}
|
|
60
124
|
function buildDefaultAgentTemplate(_agentName) {
|
|
61
125
|
return {
|
|
62
126
|
version: 1,
|
|
63
127
|
enabled: true,
|
|
64
128
|
provider: "anthropic",
|
|
65
129
|
context: { ...exports.DEFAULT_AGENT_CONTEXT },
|
|
130
|
+
senses: {
|
|
131
|
+
cli: { ...exports.DEFAULT_AGENT_SENSES.cli },
|
|
132
|
+
teams: { ...exports.DEFAULT_AGENT_SENSES.teams },
|
|
133
|
+
bluebubbles: { ...exports.DEFAULT_AGENT_SENSES.bluebubbles },
|
|
134
|
+
},
|
|
66
135
|
phrases: {
|
|
67
136
|
thinking: [...exports.DEFAULT_AGENT_PHRASES.thinking],
|
|
68
137
|
tool: [...exports.DEFAULT_AGENT_PHRASES.tool],
|
|
@@ -71,7 +140,6 @@ function buildDefaultAgentTemplate(_agentName) {
|
|
|
71
140
|
};
|
|
72
141
|
}
|
|
73
142
|
let _cachedAgentName = null;
|
|
74
|
-
let _cachedAgentConfig = null;
|
|
75
143
|
let _agentConfigOverride = null;
|
|
76
144
|
/**
|
|
77
145
|
* Parse `--agent <name>` from process.argv.
|
|
@@ -113,13 +181,49 @@ function getRepoRoot() {
|
|
|
113
181
|
* Returns the shared bundle root directory: `~/AgentBundles/`
|
|
114
182
|
*/
|
|
115
183
|
function getAgentBundlesRoot() {
|
|
116
|
-
|
|
184
|
+
const homeBase = process.env.WEBSITE_SITE_NAME ? "/home" : os.homedir();
|
|
185
|
+
return path.join(homeBase, "AgentBundles");
|
|
117
186
|
}
|
|
118
187
|
/**
|
|
119
188
|
* Returns the agent-specific bundle directory: `~/AgentBundles/<agentName>.ouro/`
|
|
120
189
|
*/
|
|
121
|
-
function getAgentRoot() {
|
|
122
|
-
return path.join(getAgentBundlesRoot(), `${
|
|
190
|
+
function getAgentRoot(agentName = getAgentName()) {
|
|
191
|
+
return path.join(getAgentBundlesRoot(), `${agentName}.ouro`);
|
|
192
|
+
}
|
|
193
|
+
function resolveOptionalAgentName(agentName) {
|
|
194
|
+
if (agentName && agentName.trim().length > 0)
|
|
195
|
+
return agentName.trim();
|
|
196
|
+
try {
|
|
197
|
+
return getAgentName();
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
return "slugger";
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Returns the bundle-local runtime state directory: `~/AgentBundles/<agentName>.ouro/state/`
|
|
205
|
+
*/
|
|
206
|
+
function getAgentStateRoot(agentName) {
|
|
207
|
+
return path.join(getAgentRoot(resolveOptionalAgentName(agentName)), "state");
|
|
208
|
+
}
|
|
209
|
+
exports.HARNESS_CANONICAL_REPO_URL = "https://github.com/ouroborosbot/ouroboros.git";
|
|
210
|
+
function getAgentRepoWorkspacesRoot(agentName) {
|
|
211
|
+
return path.join(getAgentStateRoot(resolveOptionalAgentName(agentName)), "workspaces");
|
|
212
|
+
}
|
|
213
|
+
function getAgentDaemonStateRoot(agentName) {
|
|
214
|
+
return path.join(getAgentStateRoot(resolveOptionalAgentName(agentName)), "daemon");
|
|
215
|
+
}
|
|
216
|
+
function getAgentDaemonLogsDir(agentName) {
|
|
217
|
+
return path.join(getAgentDaemonStateRoot(resolveOptionalAgentName(agentName)), "logs");
|
|
218
|
+
}
|
|
219
|
+
function getAgentDaemonLoggingConfigPath(agentName) {
|
|
220
|
+
return path.join(getAgentDaemonStateRoot(resolveOptionalAgentName(agentName)), "logging.json");
|
|
221
|
+
}
|
|
222
|
+
function getAgentMessagesRoot(agentName) {
|
|
223
|
+
return path.join(getAgentStateRoot(resolveOptionalAgentName(agentName)), "messages");
|
|
224
|
+
}
|
|
225
|
+
function getAgentToolsRoot(agentName) {
|
|
226
|
+
return path.join(getAgentStateRoot(resolveOptionalAgentName(agentName)), "tools");
|
|
123
227
|
}
|
|
124
228
|
/**
|
|
125
229
|
* Returns the conventional secrets path: `~/.agentsecrets/<agentName>/secrets.json`
|
|
@@ -129,22 +233,13 @@ function getAgentSecretsPath(agentName = getAgentName()) {
|
|
|
129
233
|
}
|
|
130
234
|
/**
|
|
131
235
|
* Load and parse `<agentRoot>/agent.json`.
|
|
132
|
-
*
|
|
236
|
+
* Reads the file fresh on each call unless an override is set.
|
|
133
237
|
* Throws descriptive error if file is missing or contains invalid JSON.
|
|
134
238
|
*/
|
|
135
239
|
function loadAgentConfig() {
|
|
136
240
|
if (_agentConfigOverride) {
|
|
137
241
|
return _agentConfigOverride;
|
|
138
242
|
}
|
|
139
|
-
if (_cachedAgentConfig) {
|
|
140
|
-
(0, runtime_1.emitNervesEvent)({
|
|
141
|
-
event: "identity.resolve",
|
|
142
|
-
component: "config/identity",
|
|
143
|
-
message: "loaded agent config from cache",
|
|
144
|
-
meta: { source: "cache" },
|
|
145
|
-
});
|
|
146
|
-
return _cachedAgentConfig;
|
|
147
|
-
}
|
|
148
243
|
const agentRoot = getAgentRoot();
|
|
149
244
|
const configFile = path.join(agentRoot, "agent.json");
|
|
150
245
|
let raw;
|
|
@@ -206,7 +301,8 @@ function loadAgentConfig() {
|
|
|
206
301
|
if (rawProvider !== "azure" &&
|
|
207
302
|
rawProvider !== "minimax" &&
|
|
208
303
|
rawProvider !== "anthropic" &&
|
|
209
|
-
rawProvider !== "openai-codex"
|
|
304
|
+
rawProvider !== "openai-codex" &&
|
|
305
|
+
rawProvider !== "github-copilot") {
|
|
210
306
|
(0, runtime_1.emitNervesEvent)({
|
|
211
307
|
level: "error",
|
|
212
308
|
event: "config_identity.error",
|
|
@@ -217,8 +313,9 @@ function loadAgentConfig() {
|
|
|
217
313
|
provider: rawProvider,
|
|
218
314
|
},
|
|
219
315
|
});
|
|
220
|
-
throw new Error(`agent.json at ${configFile} must include provider: "azure", "minimax", "anthropic",
|
|
316
|
+
throw new Error(`agent.json at ${configFile} must include provider: "azure", "minimax", "anthropic", "openai-codex", or "github-copilot".`);
|
|
221
317
|
}
|
|
318
|
+
const provider = rawProvider;
|
|
222
319
|
const rawVersion = parsed.version;
|
|
223
320
|
const version = rawVersion === undefined ? 1 : rawVersion;
|
|
224
321
|
if (typeof version !== "number" ||
|
|
@@ -251,12 +348,14 @@ function loadAgentConfig() {
|
|
|
251
348
|
});
|
|
252
349
|
throw new Error(`agent.json at ${configFile} must include enabled as boolean.`);
|
|
253
350
|
}
|
|
254
|
-
|
|
351
|
+
const config = {
|
|
255
352
|
version,
|
|
256
353
|
enabled,
|
|
257
|
-
provider
|
|
354
|
+
provider,
|
|
258
355
|
context: parsed.context,
|
|
259
356
|
logging: parsed.logging,
|
|
357
|
+
senses: normalizeSenses(parsed.senses, configFile),
|
|
358
|
+
mcpServers: parsed.mcpServers,
|
|
260
359
|
phrases: parsed.phrases,
|
|
261
360
|
};
|
|
262
361
|
(0, runtime_1.emitNervesEvent)({
|
|
@@ -265,7 +364,7 @@ function loadAgentConfig() {
|
|
|
265
364
|
message: "loaded agent config from disk",
|
|
266
365
|
meta: { source: "disk" },
|
|
267
366
|
});
|
|
268
|
-
return
|
|
367
|
+
return config;
|
|
269
368
|
}
|
|
270
369
|
/**
|
|
271
370
|
* Prime the agent name cache explicitly.
|
|
@@ -284,12 +383,18 @@ function setAgentName(name) {
|
|
|
284
383
|
function setAgentConfigOverride(config) {
|
|
285
384
|
_agentConfigOverride = config;
|
|
286
385
|
}
|
|
386
|
+
/**
|
|
387
|
+
* Preserve the compatibility hook for callers that previously cleared cached
|
|
388
|
+
* disk-backed agent config. Agent config is now read fresh on every call.
|
|
389
|
+
*/
|
|
390
|
+
function resetAgentConfigCache() {
|
|
391
|
+
// No-op: disk-backed agent config is no longer memoized in-process.
|
|
392
|
+
}
|
|
287
393
|
/**
|
|
288
394
|
* Clear all cached identity state.
|
|
289
395
|
* Used in tests and when switching agent context.
|
|
290
396
|
*/
|
|
291
397
|
function resetIdentity() {
|
|
292
398
|
_cachedAgentName = null;
|
|
293
|
-
_cachedAgentConfig = null;
|
|
294
399
|
_agentConfigOverride = null;
|
|
295
400
|
}
|
package/dist/heart/kicks.js
CHANGED
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// TODO: Kicks enforce "any action" but not "meaningful action". After a narration
|
|
3
|
-
// kick, the model can satisfy the constraint by calling a no-op tool like
|
|
4
|
-
// get_current_time({}). We need to detect trivial compliance and either re-kick
|
|
5
|
-
// or discount the tool call. Ideally, the kick message would suggest a specific
|
|
6
|
-
// tool call based on conversation context (what the user asked, what tools are
|
|
7
|
-
// relevant) rather than just saying "call a tool". That's a bigger piece of work —
|
|
8
|
-
// it requires the kick system to be context-aware.
|
|
9
|
-
// See ouroboros' observation: "i'm not chickening out. i'm satisfying a crude
|
|
10
|
-
// constraint. poorly."
|
|
11
|
-
//
|
|
12
|
-
// A kick is a self-correction. When the harness detects a malformed response,
|
|
13
|
-
// it injects an assistant-role message as if the model caught its own mistake.
|
|
14
|
-
//
|
|
15
|
-
// Kicks are:
|
|
16
|
-
// - assistant role (self-correction, not external rebuke)
|
|
17
|
-
// - first person ("I" not "you")
|
|
18
|
-
// - forward-looking (what I'm doing next, not what I did wrong)
|
|
19
|
-
// - short (one sentence)
|
|
20
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
3
|
exports.hasToolIntent = hasToolIntent;
|
|
22
4
|
exports.detectKick = detectKick;
|
|
5
|
+
const runtime_1 = require("../nerves/runtime");
|
|
23
6
|
const KICK_MESSAGES = {
|
|
24
7
|
empty: "I sent an empty message by accident — let me try again.",
|
|
25
8
|
narration: "I narrated instead of acting. Using the tool now -- if done, calling final_answer.",
|
|
@@ -141,4 +124,3 @@ function detectKick(content, options) {
|
|
|
141
124
|
}
|
|
142
125
|
return null;
|
|
143
126
|
}
|
|
144
|
-
const runtime_1 = require("../nerves/runtime");
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MODEL_CAPABILITIES = void 0;
|
|
4
|
+
exports.getModelCapabilities = getModelCapabilities;
|
|
5
|
+
const runtime_1 = require("../nerves/runtime");
|
|
6
|
+
exports.MODEL_CAPABILITIES = {
|
|
7
|
+
"claude-opus-4-6": {
|
|
8
|
+
reasoningEffort: ["low", "medium", "high", "max"],
|
|
9
|
+
thinkingFormat: "anthropic",
|
|
10
|
+
maxOutputTokens: 128000,
|
|
11
|
+
},
|
|
12
|
+
"claude-sonnet-4-6": {
|
|
13
|
+
reasoningEffort: ["low", "medium", "high"],
|
|
14
|
+
thinkingFormat: "anthropic",
|
|
15
|
+
maxOutputTokens: 64000,
|
|
16
|
+
},
|
|
17
|
+
"claude-opus-4.6": {
|
|
18
|
+
reasoningEffort: ["low", "medium", "high", "max"],
|
|
19
|
+
maxOutputTokens: 128000,
|
|
20
|
+
},
|
|
21
|
+
"claude-sonnet-4.6": {
|
|
22
|
+
reasoningEffort: ["low", "medium", "high"],
|
|
23
|
+
maxOutputTokens: 64000,
|
|
24
|
+
},
|
|
25
|
+
"gpt-5.4": {
|
|
26
|
+
reasoningEffort: ["low", "medium", "high"],
|
|
27
|
+
phase: true,
|
|
28
|
+
maxOutputTokens: 100000,
|
|
29
|
+
},
|
|
30
|
+
"gpt-5.3-codex": {
|
|
31
|
+
reasoningEffort: ["low", "medium", "high"],
|
|
32
|
+
phase: true,
|
|
33
|
+
maxOutputTokens: 100000,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
const EMPTY_CAPABILITIES = Object.freeze({});
|
|
37
|
+
function getModelCapabilities(modelId) {
|
|
38
|
+
(0, runtime_1.emitNervesEvent)({
|
|
39
|
+
component: "engine",
|
|
40
|
+
event: "engine.model_capabilities_lookup",
|
|
41
|
+
message: `model capabilities lookup: ${modelId}`,
|
|
42
|
+
meta: { modelId, found: modelId in exports.MODEL_CAPABILITIES },
|
|
43
|
+
});
|
|
44
|
+
const entry = exports.MODEL_CAPABILITIES[modelId];
|
|
45
|
+
if (entry)
|
|
46
|
+
return entry;
|
|
47
|
+
return { ...EMPTY_CAPABILITIES };
|
|
48
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildProgressStory = buildProgressStory;
|
|
4
|
+
exports.renderProgressStory = renderProgressStory;
|
|
5
|
+
const runtime_1 = require("../nerves/runtime");
|
|
6
|
+
function labelForScope(scope) {
|
|
7
|
+
return scope === "inner-delegation" ? "inner work" : "shared work";
|
|
8
|
+
}
|
|
9
|
+
function compactDetail(text) {
|
|
10
|
+
if (typeof text !== "string")
|
|
11
|
+
return null;
|
|
12
|
+
const trimmed = text.trim();
|
|
13
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
14
|
+
}
|
|
15
|
+
function buildProgressStory(input) {
|
|
16
|
+
const detailLines = [
|
|
17
|
+
compactDetail(input.objective),
|
|
18
|
+
compactDetail(input.outcomeText),
|
|
19
|
+
compactDetail(input.bridgeId ? `bridge: ${input.bridgeId}` : null),
|
|
20
|
+
compactDetail(input.taskName ? `task: ${input.taskName}` : null),
|
|
21
|
+
].filter((line) => Boolean(line));
|
|
22
|
+
const story = {
|
|
23
|
+
statusLine: `${labelForScope(input.scope)}: ${input.phase}`,
|
|
24
|
+
detailLines,
|
|
25
|
+
};
|
|
26
|
+
(0, runtime_1.emitNervesEvent)({
|
|
27
|
+
component: "engine",
|
|
28
|
+
event: "engine.progress_story_build",
|
|
29
|
+
message: "built shared progress story",
|
|
30
|
+
meta: {
|
|
31
|
+
scope: input.scope,
|
|
32
|
+
phase: input.phase,
|
|
33
|
+
detailLines: detailLines.length,
|
|
34
|
+
hasBridge: Boolean(input.bridgeId),
|
|
35
|
+
hasTask: Boolean(input.taskName),
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
return story;
|
|
39
|
+
}
|
|
40
|
+
function renderProgressStory(story) {
|
|
41
|
+
return [story.statusLine, ...story.detailLines].join("\n");
|
|
42
|
+
}
|