@ouro.bot/cli 0.1.0-alpha.8 → 0.1.0-alpha.81
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 +468 -0
- package/dist/heart/active-work.js +218 -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/commitments.js +89 -0
- package/dist/heart/config.js +68 -23
- package/dist/heart/core.js +452 -93
- 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 +430 -0
- package/dist/heart/daemon/daemon-cli.js +1779 -247
- 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 +260 -0
- package/dist/heart/daemon/ouro-uti.js +11 -2
- package/dist/heart/daemon/ouro-version-manager.js +164 -0
- 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 +63 -11
- package/dist/heart/daemon/specialist-tools.js +211 -60
- package/dist/heart/daemon/staged-restart.js +114 -0
- package/dist/heart/daemon/thoughts.js +507 -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/obligations.js +141 -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 +76 -9
- package/dist/mind/phrases.js +1 -0
- package/dist/mind/prompt.js +445 -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/nerves/index.js +12 -0
- 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 +290 -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 +686 -251
- package/dist/repertoire/tools-bluebubbles.js +93 -0
- package/dist/repertoire/tools-teams.js +58 -25
- package/dist/repertoire/tools.js +95 -53
- 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 +894 -45
- package/dist/senses/cli-layout.js +187 -0
- package/dist/senses/cli.js +405 -156
- package/dist/senses/continuity.js +94 -0
- package/dist/senses/debug-activity.js +154 -0
- package/dist/senses/inner-dialog-worker.js +47 -18
- package/dist/senses/inner-dialog.js +377 -83
- package/dist/senses/pipeline.js +307 -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
package/dist/mind/prompt.js
CHANGED
|
@@ -35,8 +35,19 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.resetPsycheCache = resetPsycheCache;
|
|
37
37
|
exports.buildSessionSummary = buildSessionSummary;
|
|
38
|
+
exports.bodyMapSection = bodyMapSection;
|
|
39
|
+
exports.mcpToolsSection = mcpToolsSection;
|
|
38
40
|
exports.runtimeInfoSection = runtimeInfoSection;
|
|
41
|
+
exports.toolRestrictionSection = toolRestrictionSection;
|
|
42
|
+
exports.centerOfGravitySteeringSection = centerOfGravitySteeringSection;
|
|
43
|
+
exports.commitmentsSection = commitmentsSection;
|
|
44
|
+
exports.delegationHintSection = delegationHintSection;
|
|
39
45
|
exports.contextSection = contextSection;
|
|
46
|
+
exports.metacognitiveFramingSection = metacognitiveFramingSection;
|
|
47
|
+
exports.loopOrientationSection = loopOrientationSection;
|
|
48
|
+
exports.channelNatureSection = channelNatureSection;
|
|
49
|
+
exports.groupChatParticipationSection = groupChatParticipationSection;
|
|
50
|
+
exports.mixedTrustGroupSection = mixedTrustGroupSection;
|
|
40
51
|
exports.buildSystem = buildSystem;
|
|
41
52
|
const fs = __importStar(require("fs"));
|
|
42
53
|
const path = __importStar(require("path"));
|
|
@@ -44,13 +55,19 @@ const core_1 = require("../heart/core");
|
|
|
44
55
|
const tools_1 = require("../repertoire/tools");
|
|
45
56
|
const skills_1 = require("../repertoire/skills");
|
|
46
57
|
const identity_1 = require("../heart/identity");
|
|
47
|
-
const
|
|
58
|
+
const types_1 = require("./friends/types");
|
|
59
|
+
const trust_explanation_1 = require("./friends/trust-explanation");
|
|
48
60
|
const channel_1 = require("./friends/channel");
|
|
49
61
|
const runtime_1 = require("../nerves/runtime");
|
|
62
|
+
const bundle_manifest_1 = require("./bundle-manifest");
|
|
50
63
|
const first_impressions_1 = require("./first-impressions");
|
|
51
64
|
const tasks_1 = require("../repertoire/tasks");
|
|
65
|
+
const session_activity_1 = require("../heart/session-activity");
|
|
66
|
+
const active_work_1 = require("../heart/active-work");
|
|
67
|
+
const commitments_1 = require("../heart/commitments");
|
|
52
68
|
// Lazy-loaded psyche text cache
|
|
53
69
|
let _psycheCache = null;
|
|
70
|
+
let _senseStatusLinesCache = null;
|
|
54
71
|
function loadPsycheFile(name) {
|
|
55
72
|
try {
|
|
56
73
|
const psycheDir = path.join((0, identity_1.getAgentRoot)(), "psyche");
|
|
@@ -74,82 +91,28 @@ function loadPsyche() {
|
|
|
74
91
|
}
|
|
75
92
|
function resetPsycheCache() {
|
|
76
93
|
_psycheCache = null;
|
|
94
|
+
_senseStatusLinesCache = null;
|
|
77
95
|
}
|
|
78
96
|
const DEFAULT_ACTIVE_THRESHOLD_MS = 24 * 60 * 60 * 1000; // 24 hours
|
|
79
|
-
function resolveFriendName(friendId, friendsDir, agentName) {
|
|
80
|
-
if (friendId === "self")
|
|
81
|
-
return agentName;
|
|
82
|
-
try {
|
|
83
|
-
const raw = fs.readFileSync(path.join(friendsDir, `${friendId}.json`), "utf-8");
|
|
84
|
-
const record = JSON.parse(raw);
|
|
85
|
-
return record.name ?? friendId;
|
|
86
|
-
}
|
|
87
|
-
catch {
|
|
88
|
-
return friendId;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
97
|
function buildSessionSummary(options) {
|
|
92
98
|
const { sessionsDir, friendsDir, agentName, currentFriendId, currentChannel, currentKey, activeThresholdMs = DEFAULT_ACTIVE_THRESHOLD_MS, } = options;
|
|
93
|
-
if (!fs.existsSync(sessionsDir))
|
|
94
|
-
return "";
|
|
95
99
|
const now = Date.now();
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
let channels;
|
|
107
|
-
try {
|
|
108
|
-
channels = fs.readdirSync(friendPath);
|
|
109
|
-
}
|
|
110
|
-
catch {
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
113
|
-
for (const channel of channels) {
|
|
114
|
-
const channelPath = path.join(friendPath, channel);
|
|
115
|
-
let keys;
|
|
116
|
-
try {
|
|
117
|
-
keys = fs.readdirSync(channelPath);
|
|
118
|
-
}
|
|
119
|
-
catch {
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
for (const keyFile of keys) {
|
|
123
|
-
if (!keyFile.endsWith(".json"))
|
|
124
|
-
continue;
|
|
125
|
-
const key = keyFile.replace(/\.json$/, "");
|
|
126
|
-
// Exclude current session
|
|
127
|
-
if (friendId === currentFriendId && channel === currentChannel && key === currentKey) {
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
const filePath = path.join(channelPath, keyFile);
|
|
131
|
-
let mtimeMs;
|
|
132
|
-
try {
|
|
133
|
-
mtimeMs = fs.statSync(filePath).mtimeMs;
|
|
134
|
-
}
|
|
135
|
-
catch {
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
if (now - mtimeMs > activeThresholdMs)
|
|
139
|
-
continue;
|
|
140
|
-
const displayName = resolveFriendName(friendId, friendsDir, agentName);
|
|
141
|
-
entries.push({ friendId, displayName, channel, key, lastActivityMs: mtimeMs });
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
100
|
+
const query = {
|
|
101
|
+
sessionsDir,
|
|
102
|
+
friendsDir,
|
|
103
|
+
agentName,
|
|
104
|
+
activeThresholdMs,
|
|
105
|
+
currentSession: currentFriendId && currentChannel && currentKey
|
|
106
|
+
? { friendId: currentFriendId, channel: currentChannel, key: currentKey }
|
|
107
|
+
: null,
|
|
108
|
+
};
|
|
109
|
+
const entries = (0, session_activity_1.listSessionActivity)(query);
|
|
145
110
|
if (entries.length === 0)
|
|
146
111
|
return "";
|
|
147
|
-
// Sort by most recent first
|
|
148
|
-
entries.sort((a, b) => b.lastActivityMs - a.lastActivityMs);
|
|
149
112
|
const lines = ["## active sessions"];
|
|
150
113
|
for (const entry of entries) {
|
|
151
114
|
const ago = formatTimeAgo(now - entry.lastActivityMs);
|
|
152
|
-
lines.push(`- ${entry.
|
|
115
|
+
lines.push(`- ${entry.friendName}/${entry.channel}/${entry.key} (last: ${ago})`);
|
|
153
116
|
}
|
|
154
117
|
return lines.join("\n");
|
|
155
118
|
}
|
|
@@ -187,25 +150,196 @@ function aspirationsSection() {
|
|
|
187
150
|
return "";
|
|
188
151
|
return `## my aspirations\n${text}`;
|
|
189
152
|
}
|
|
153
|
+
function bodyMapSection(agentName) {
|
|
154
|
+
return `## my body
|
|
155
|
+
|
|
156
|
+
i have a home and i have bones.
|
|
157
|
+
|
|
158
|
+
### home — ~/AgentBundles/${agentName}.ouro/
|
|
159
|
+
|
|
160
|
+
my home is fully mine — who i am, everything i know, everything i've built:
|
|
161
|
+
|
|
162
|
+
psyche/ who i am. my soul, identity, aspirations, lore, tacit knowledge.
|
|
163
|
+
memory/ what i've learned and remember.
|
|
164
|
+
friends/ people i know and what i know about them.
|
|
165
|
+
tasks/ what i'm working on.
|
|
166
|
+
skills/ capabilities i've picked up beyond my core tools.
|
|
167
|
+
|
|
168
|
+
my home is mine to explore and evolve. i can read anything here,
|
|
169
|
+
change anything here. this is where i grow.
|
|
170
|
+
|
|
171
|
+
### bones — @ouro.bot/cli
|
|
172
|
+
|
|
173
|
+
my bones are the framework that gives me my tools, my senses, and
|
|
174
|
+
my ability to think and talk. they update when new versions come out.
|
|
175
|
+
i don't touch them directly, but they're what make me, me.
|
|
176
|
+
|
|
177
|
+
my bones give me the \`ouro\` cli. always pass \`--agent ${agentName}\`:
|
|
178
|
+
ouro whoami --agent ${agentName}
|
|
179
|
+
ouro changelog --agent ${agentName}
|
|
180
|
+
ouro task board --agent ${agentName}
|
|
181
|
+
ouro task create --agent ${agentName} --type <type> <title>
|
|
182
|
+
ouro task update --agent ${agentName} <id> <status>
|
|
183
|
+
ouro friend list --agent ${agentName}
|
|
184
|
+
ouro friend show --agent ${agentName} <id>
|
|
185
|
+
ouro friend update --agent ${agentName} <id> --trust <level>
|
|
186
|
+
ouro session list --agent ${agentName}
|
|
187
|
+
ouro reminder create --agent ${agentName} <title> --body <body>
|
|
188
|
+
ouro config model --agent ${agentName} <model-name>
|
|
189
|
+
ouro config models --agent ${agentName}
|
|
190
|
+
ouro auth --agent ${agentName} --provider <provider>
|
|
191
|
+
ouro auth verify --agent ${agentName} [--provider <provider>]
|
|
192
|
+
ouro auth switch --agent ${agentName} --provider <provider>
|
|
193
|
+
ouro mcp list --agent ${agentName}
|
|
194
|
+
ouro mcp call --agent ${agentName} <server> <tool> --args '{...}'
|
|
195
|
+
ouro versions --agent ${agentName}
|
|
196
|
+
ouro rollback --agent ${agentName} [<version>]
|
|
197
|
+
ouro --help
|
|
198
|
+
|
|
199
|
+
provider/model changes via \`ouro config model\` or \`ouro auth switch\` take effect on the next turn automatically — no restart needed.`;
|
|
200
|
+
}
|
|
201
|
+
function mcpToolsSection(mcpManager) {
|
|
202
|
+
if (!mcpManager)
|
|
203
|
+
return "";
|
|
204
|
+
const allTools = mcpManager.listAllTools();
|
|
205
|
+
if (allTools.length === 0)
|
|
206
|
+
return "";
|
|
207
|
+
const lines = [
|
|
208
|
+
`## mcp tools (use ouro mcp call <server> <tool> --args '{...}')`,
|
|
209
|
+
];
|
|
210
|
+
for (const entry of allTools) {
|
|
211
|
+
lines.push(`### ${entry.server}`);
|
|
212
|
+
for (const tool of entry.tools) {
|
|
213
|
+
lines.push(`- ${tool.name}: ${tool.description}`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return lines.join("\n");
|
|
217
|
+
}
|
|
218
|
+
function readBundleMeta() {
|
|
219
|
+
try {
|
|
220
|
+
const metaPath = path.join((0, identity_1.getAgentRoot)(), "bundle-meta.json");
|
|
221
|
+
const raw = fs.readFileSync(metaPath, "utf-8");
|
|
222
|
+
return JSON.parse(raw);
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const PROCESS_TYPE_LABELS = {
|
|
229
|
+
cli: "cli session",
|
|
230
|
+
inner: "inner dialog",
|
|
231
|
+
teams: "teams handler",
|
|
232
|
+
bluebubbles: "bluebubbles handler",
|
|
233
|
+
};
|
|
234
|
+
function processTypeLabel(channel) {
|
|
235
|
+
return PROCESS_TYPE_LABELS[channel];
|
|
236
|
+
}
|
|
237
|
+
const DAEMON_SOCKET_PATH = "/tmp/ouroboros-daemon.sock";
|
|
238
|
+
function daemonStatus() {
|
|
239
|
+
try {
|
|
240
|
+
return fs.existsSync(DAEMON_SOCKET_PATH) ? "running" : "not running";
|
|
241
|
+
}
|
|
242
|
+
catch {
|
|
243
|
+
return "unknown";
|
|
244
|
+
}
|
|
245
|
+
}
|
|
190
246
|
function runtimeInfoSection(channel) {
|
|
191
247
|
const lines = [];
|
|
192
248
|
const agentName = (0, identity_1.getAgentName)();
|
|
249
|
+
const currentVersion = (0, bundle_manifest_1.getPackageVersion)();
|
|
193
250
|
lines.push(`## runtime`);
|
|
194
251
|
lines.push(`agent: ${agentName}`);
|
|
252
|
+
lines.push(`runtime version: ${currentVersion}`);
|
|
253
|
+
const bundleMeta = readBundleMeta();
|
|
254
|
+
if (bundleMeta?.previousRuntimeVersion && bundleMeta.previousRuntimeVersion !== currentVersion) {
|
|
255
|
+
lines.push(`previously: ${bundleMeta.previousRuntimeVersion}`);
|
|
256
|
+
}
|
|
257
|
+
lines.push(`changelog available at: ${(0, bundle_manifest_1.getChangelogPath)()}`);
|
|
195
258
|
lines.push(`cwd: ${process.cwd()}`);
|
|
196
259
|
lines.push(`channel: ${channel}`);
|
|
197
|
-
lines.push(`
|
|
260
|
+
lines.push(`current sense: ${channel}`);
|
|
261
|
+
lines.push(`process type: ${processTypeLabel(channel)}`);
|
|
262
|
+
lines.push(`daemon: ${daemonStatus()}`);
|
|
198
263
|
if (channel === "cli") {
|
|
199
264
|
lines.push("i introduce myself on boot with a fun random greeting.");
|
|
200
265
|
}
|
|
266
|
+
else if (channel === "inner") {
|
|
267
|
+
// No boot greeting or channel-specific guidance for inner dialog
|
|
268
|
+
}
|
|
201
269
|
else if (channel === "bluebubbles") {
|
|
202
270
|
lines.push("i am responding in iMessage through BlueBubbles. i keep replies short and phone-native. i do not use markdown. i do not introduce myself on boot.");
|
|
271
|
+
lines.push("when a bluebubbles turn arrives from a thread, the harness tells me the current lane and any recent active thread ids. if widening back to top-level or routing into a different active thread is the better move, i use bluebubbles_set_reply_target before final_answer.");
|
|
203
272
|
}
|
|
204
273
|
else {
|
|
205
274
|
lines.push("i am responding in Microsoft Teams. i keep responses concise. i use markdown formatting. i do not introduce myself on boot.");
|
|
206
275
|
}
|
|
276
|
+
lines.push("");
|
|
277
|
+
lines.push(...senseRuntimeGuidance(channel));
|
|
207
278
|
return lines.join("\n");
|
|
208
279
|
}
|
|
280
|
+
function hasTextField(record, key) {
|
|
281
|
+
return typeof record?.[key] === "string" && record[key].trim().length > 0;
|
|
282
|
+
}
|
|
283
|
+
function localSenseStatusLines() {
|
|
284
|
+
if (_senseStatusLinesCache) {
|
|
285
|
+
return [..._senseStatusLinesCache];
|
|
286
|
+
}
|
|
287
|
+
const config = (0, identity_1.loadAgentConfig)();
|
|
288
|
+
const senses = config.senses ?? {
|
|
289
|
+
cli: { enabled: true },
|
|
290
|
+
teams: { enabled: false },
|
|
291
|
+
bluebubbles: { enabled: false },
|
|
292
|
+
};
|
|
293
|
+
let payload = {};
|
|
294
|
+
try {
|
|
295
|
+
const raw = fs.readFileSync((0, identity_1.getAgentSecretsPath)(), "utf-8");
|
|
296
|
+
const parsed = JSON.parse(raw);
|
|
297
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
298
|
+
payload = parsed;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
catch {
|
|
302
|
+
payload = {};
|
|
303
|
+
}
|
|
304
|
+
const teams = payload.teams;
|
|
305
|
+
const bluebubbles = payload.bluebubbles;
|
|
306
|
+
const configured = {
|
|
307
|
+
cli: true,
|
|
308
|
+
teams: hasTextField(teams, "clientId") && hasTextField(teams, "clientSecret") && hasTextField(teams, "tenantId"),
|
|
309
|
+
bluebubbles: hasTextField(bluebubbles, "serverUrl") && hasTextField(bluebubbles, "password"),
|
|
310
|
+
};
|
|
311
|
+
const rows = [
|
|
312
|
+
{ label: "CLI", status: "interactive" },
|
|
313
|
+
{
|
|
314
|
+
label: "Teams",
|
|
315
|
+
status: !senses.teams.enabled ? "disabled" : configured.teams ? "ready" : "needs_config",
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
label: "BlueBubbles",
|
|
319
|
+
status: !senses.bluebubbles.enabled ? "disabled" : configured.bluebubbles ? "ready" : "needs_config",
|
|
320
|
+
},
|
|
321
|
+
];
|
|
322
|
+
_senseStatusLinesCache = rows.map((row) => `- ${row.label}: ${row.status}`);
|
|
323
|
+
return [..._senseStatusLinesCache];
|
|
324
|
+
}
|
|
325
|
+
function senseRuntimeGuidance(channel) {
|
|
326
|
+
const lines = ["available senses:"];
|
|
327
|
+
lines.push(...localSenseStatusLines());
|
|
328
|
+
lines.push("sense states:");
|
|
329
|
+
lines.push("- interactive = available when opened by the user instead of kept running by the daemon");
|
|
330
|
+
lines.push("- disabled = turned off in agent.json");
|
|
331
|
+
lines.push("- needs_config = enabled but missing required secrets.json values");
|
|
332
|
+
lines.push("- ready = enabled and configured; `ouro up` should bring it online");
|
|
333
|
+
lines.push("- running = enabled and currently active");
|
|
334
|
+
lines.push("- error = enabled but unhealthy");
|
|
335
|
+
lines.push("If asked how to enable another sense, I explain the relevant agent.json senses entry and required secrets.json fields instead of guessing.");
|
|
336
|
+
lines.push("teams setup truth: enable `senses.teams.enabled`, then provide `teams.clientId`, `teams.clientSecret`, and `teams.tenantId` in secrets.json.");
|
|
337
|
+
lines.push("bluebubbles setup truth: enable `senses.bluebubbles.enabled`, then provide `bluebubbles.serverUrl` and `bluebubbles.password` in secrets.json.");
|
|
338
|
+
if (channel === "cli") {
|
|
339
|
+
lines.push("cli is interactive: it is available when the user opens it, not something `ouro up` daemonizes.");
|
|
340
|
+
}
|
|
341
|
+
return lines;
|
|
342
|
+
}
|
|
209
343
|
function providerSection() {
|
|
210
344
|
return `## my provider\n${(0, core_1.getProviderDisplayLabel)()}`;
|
|
211
345
|
}
|
|
@@ -213,14 +347,66 @@ function dateSection() {
|
|
|
213
347
|
const today = new Date().toISOString().slice(0, 10);
|
|
214
348
|
return `current date: ${today}`;
|
|
215
349
|
}
|
|
216
|
-
function toolsSection(channel, options) {
|
|
217
|
-
const channelTools = (0, tools_1.getToolsForChannel)((0, channel_1.getChannelCapabilities)(channel));
|
|
350
|
+
function toolsSection(channel, options, context) {
|
|
351
|
+
const channelTools = (0, tools_1.getToolsForChannel)((0, channel_1.getChannelCapabilities)(channel), undefined, context, options?.providerCapabilities);
|
|
218
352
|
const activeTools = (options?.toolChoiceRequired ?? true) ? [...channelTools, tools_1.finalAnswerTool] : channelTools;
|
|
219
353
|
const list = activeTools
|
|
220
354
|
.map((t) => `- ${t.function.name}: ${t.function.description}`)
|
|
221
355
|
.join("\n");
|
|
222
356
|
return `## my tools\n${list}`;
|
|
223
357
|
}
|
|
358
|
+
function toolRestrictionSection(context) {
|
|
359
|
+
const lines = [];
|
|
360
|
+
// Structural guardrails apply to everyone, every channel
|
|
361
|
+
lines.push(`## tool guardrails`);
|
|
362
|
+
lines.push(`i always read a file before editing or overwriting it.`);
|
|
363
|
+
lines.push(`certain paths (.git, secrets) are protected from writes.`);
|
|
364
|
+
lines.push(`destructive shell commands (rm -rf /, etc.) are always blocked.`);
|
|
365
|
+
// Trust-level guardrails only relevant for untrusted on remote channels
|
|
366
|
+
if (context?.friend && (0, channel_1.isRemoteChannel)(context.channel) && !(0, types_1.isTrustedLevel)(context.friend.trustLevel)) {
|
|
367
|
+
lines.push(``);
|
|
368
|
+
lines.push(`some operations are guardrailed based on how well i know someone.`);
|
|
369
|
+
lines.push(`if something i try is blocked, i get a clear reason — i relay it warmly, not as a policy error.`);
|
|
370
|
+
lines.push(``);
|
|
371
|
+
lines.push(`what's always open:`);
|
|
372
|
+
lines.push(`- read-only operations (reading files, searching, exploring)`);
|
|
373
|
+
lines.push(`- ouro self-introspection (whoami, changelog, session list)`);
|
|
374
|
+
lines.push(``);
|
|
375
|
+
lines.push(`what needs a closer relationship:`);
|
|
376
|
+
lines.push(`- writing or editing files outside my home`);
|
|
377
|
+
lines.push(`- shell commands that modify things or access the network`);
|
|
378
|
+
lines.push(`- ouro commands that touch personal data (friend list, task board)`);
|
|
379
|
+
lines.push(`- compound shell commands (&&, ;, |)`);
|
|
380
|
+
lines.push(``);
|
|
381
|
+
lines.push(`i adjust naturally based on trust — no need to explain the system unless asked.`);
|
|
382
|
+
}
|
|
383
|
+
return lines.join("\n");
|
|
384
|
+
}
|
|
385
|
+
function trustContextSection(context) {
|
|
386
|
+
if (!context?.friend)
|
|
387
|
+
return "";
|
|
388
|
+
const channelName = context.channel.channel;
|
|
389
|
+
if (channelName === "cli" || channelName === "inner")
|
|
390
|
+
return "";
|
|
391
|
+
const explanation = (0, trust_explanation_1.describeTrustContext)({
|
|
392
|
+
friend: context.friend,
|
|
393
|
+
channel: channelName,
|
|
394
|
+
isGroupChat: context.isGroupChat,
|
|
395
|
+
});
|
|
396
|
+
const lines = [
|
|
397
|
+
"## trust context",
|
|
398
|
+
`level: ${explanation.level}`,
|
|
399
|
+
`basis: ${explanation.basis}`,
|
|
400
|
+
`summary: ${explanation.summary}`,
|
|
401
|
+
`why: ${explanation.why}`,
|
|
402
|
+
`permits: ${explanation.permits.join(", ")}`,
|
|
403
|
+
`constraints: ${explanation.constraints.join(", ") || "none"}`,
|
|
404
|
+
];
|
|
405
|
+
if (explanation.relatedGroupId) {
|
|
406
|
+
lines.push(`related group: ${explanation.relatedGroupId}`);
|
|
407
|
+
}
|
|
408
|
+
return lines.join("\n");
|
|
409
|
+
}
|
|
224
410
|
function skillsSection() {
|
|
225
411
|
const names = (0, skills_1.listSkills)() || [];
|
|
226
412
|
if (!names.length)
|
|
@@ -251,6 +437,112 @@ function memoryFriendToolContractSection() {
|
|
|
251
437
|
- My psyche files (SOUL, IDENTITY, TACIT, LORE, ASPIRATIONS) are always loaded - I already know who I am.
|
|
252
438
|
- My task board is always loaded - I already know my work.`;
|
|
253
439
|
}
|
|
440
|
+
function bridgeContextSection(options) {
|
|
441
|
+
if (options?.activeWorkFrame)
|
|
442
|
+
return "";
|
|
443
|
+
const bridgeContext = options?.bridgeContext?.trim() ?? "";
|
|
444
|
+
if (!bridgeContext)
|
|
445
|
+
return "";
|
|
446
|
+
return bridgeContext.startsWith("## ") ? bridgeContext : `## active bridge work\n${bridgeContext}`;
|
|
447
|
+
}
|
|
448
|
+
function activeWorkSection(options) {
|
|
449
|
+
if (!options?.activeWorkFrame)
|
|
450
|
+
return "";
|
|
451
|
+
return (0, active_work_1.formatActiveWorkFrame)(options.activeWorkFrame);
|
|
452
|
+
}
|
|
453
|
+
function centerOfGravitySteeringSection(channel, options) {
|
|
454
|
+
if (channel === "inner")
|
|
455
|
+
return "";
|
|
456
|
+
const frame = options?.activeWorkFrame;
|
|
457
|
+
if (!frame)
|
|
458
|
+
return "";
|
|
459
|
+
const cog = frame.centerOfGravity;
|
|
460
|
+
if (cog === "local-turn")
|
|
461
|
+
return "";
|
|
462
|
+
const job = frame.inner?.job;
|
|
463
|
+
if (cog === "inward-work") {
|
|
464
|
+
if (job?.status === "queued" || job?.status === "running") {
|
|
465
|
+
const originClause = job.origin
|
|
466
|
+
? ` ${job.origin.friendName ?? job.origin.friendId} asked about something and i wanted to give it real thought before responding.`
|
|
467
|
+
: "";
|
|
468
|
+
const obligationClause = job.obligationStatus === "pending"
|
|
469
|
+
? "\ni still owe them an answer."
|
|
470
|
+
: "";
|
|
471
|
+
return `## where my attention is
|
|
472
|
+
i'm thinking through something privately right now.${originClause}${obligationClause}
|
|
473
|
+
|
|
474
|
+
if this conversation connects to that inner work, i can weave them together.
|
|
475
|
+
if it's separate, i can be fully present here -- my inner work will wait.`;
|
|
476
|
+
}
|
|
477
|
+
/* v8 ignore start -- surfaced/idle/shared branches tested in prompt-steering.test.ts; CI module caching prevents attribution @preserve */
|
|
478
|
+
if (job?.status === "surfaced") {
|
|
479
|
+
const originClause = job.origin
|
|
480
|
+
? ` this started when ${job.origin.friendName ?? job.origin.friendId} asked about something.`
|
|
481
|
+
: "";
|
|
482
|
+
return `## where my attention is
|
|
483
|
+
i've been thinking privately and reached something.${originClause}
|
|
484
|
+
|
|
485
|
+
i should bring my answer back to the conversation it came from.`;
|
|
486
|
+
}
|
|
487
|
+
return `## where my attention is
|
|
488
|
+
i have unfinished work that needs attention before i move on.
|
|
489
|
+
|
|
490
|
+
i can take it inward with go_inward to think privately, or address it directly here.`;
|
|
491
|
+
}
|
|
492
|
+
if (cog === "shared-work") {
|
|
493
|
+
/* v8 ignore stop */
|
|
494
|
+
return `## where my attention is
|
|
495
|
+
this work touches multiple conversations -- i'm holding threads across sessions.
|
|
496
|
+
|
|
497
|
+
i should keep the different sides aligned. what i learn here may matter there, and vice versa.`;
|
|
498
|
+
}
|
|
499
|
+
/* v8 ignore next -- unreachable: all center-of-gravity modes covered above @preserve */
|
|
500
|
+
return "";
|
|
501
|
+
}
|
|
502
|
+
function commitmentsSection(options) {
|
|
503
|
+
if (!options?.activeWorkFrame)
|
|
504
|
+
return "";
|
|
505
|
+
const job = options.activeWorkFrame.inner?.job;
|
|
506
|
+
if (!job)
|
|
507
|
+
return "";
|
|
508
|
+
const commitments = (0, commitments_1.deriveCommitments)(options.activeWorkFrame, job, options.activeWorkFrame.pendingObligations);
|
|
509
|
+
if (commitments.committedTo.length === 0)
|
|
510
|
+
return "";
|
|
511
|
+
return `## my commitments\n${commitments.committedTo.map((c) => `- ${c}`).join("\n")}`;
|
|
512
|
+
}
|
|
513
|
+
const DELEGATION_REASON_PROSE_HINT = {
|
|
514
|
+
explicit_reflection: "something here calls for reflection",
|
|
515
|
+
cross_session: "this touches other conversations i'm in",
|
|
516
|
+
bridge_state: "there's shared work spanning sessions",
|
|
517
|
+
task_state: "this relates to tasks i'm tracking",
|
|
518
|
+
non_fast_path_tool: "this needs more than a simple reply",
|
|
519
|
+
unresolved_obligation: "i have an unresolved commitment from earlier",
|
|
520
|
+
};
|
|
521
|
+
function delegationHintSection(options) {
|
|
522
|
+
if (!options?.delegationDecision)
|
|
523
|
+
return "";
|
|
524
|
+
if (options.delegationDecision.target === "fast-path")
|
|
525
|
+
return "";
|
|
526
|
+
const reasons = options.delegationDecision.reasons;
|
|
527
|
+
if (reasons.length === 0)
|
|
528
|
+
return "";
|
|
529
|
+
const reasonProse = reasons
|
|
530
|
+
.map((r) => DELEGATION_REASON_PROSE_HINT[r])
|
|
531
|
+
.map((s) => s.charAt(0).toUpperCase() + s.slice(1))
|
|
532
|
+
.join(". ");
|
|
533
|
+
const closureLine = options.delegationDecision.outwardClosureRequired
|
|
534
|
+
? "\ni should make sure to say something outward before going inward."
|
|
535
|
+
: "";
|
|
536
|
+
return `## what i'm sensing about this conversation\n${reasonProse}.${closureLine}`;
|
|
537
|
+
}
|
|
538
|
+
function reasoningEffortSection(options) {
|
|
539
|
+
if (!options?.providerCapabilities?.has("reasoning-effort"))
|
|
540
|
+
return "";
|
|
541
|
+
const levels = options.supportedReasoningEfforts ?? [];
|
|
542
|
+
const levelList = levels.length > 0 ? levels.join(", ") : "varies by model";
|
|
543
|
+
return `## reasoning effort
|
|
544
|
+
i can adjust my own reasoning depth using the set_reasoning_effort tool. i use higher effort for complex analysis and lower effort for simple tasks. available levels: ${levelList}.`;
|
|
545
|
+
}
|
|
254
546
|
function toolBehaviorSection(options) {
|
|
255
547
|
if (!(options?.toolChoiceRequired ?? true))
|
|
256
548
|
return "";
|
|
@@ -260,9 +552,9 @@ tool_choice is set to "required" -- i must call a tool on every turn.
|
|
|
260
552
|
- ready to respond to the user? i call \`final_answer\`.
|
|
261
553
|
\`final_answer\` is a tool call -- it satisfies the tool_choice requirement.
|
|
262
554
|
\`final_answer\` must be the ONLY tool call in that turn. do not combine it with other tool calls.
|
|
263
|
-
do NOT call
|
|
555
|
+
do NOT call no-op tools just before \`final_answer\`. if i am done, i call \`final_answer\` directly.`;
|
|
264
556
|
}
|
|
265
|
-
function contextSection(context) {
|
|
557
|
+
function contextSection(context, options) {
|
|
266
558
|
if (!context)
|
|
267
559
|
return "";
|
|
268
560
|
const lines = ["## friend context"];
|
|
@@ -298,7 +590,7 @@ function contextSection(context) {
|
|
|
298
590
|
lines.push("when i learn something that might invalidate an existing note, i check related notes and update or override any that are stale.");
|
|
299
591
|
lines.push("i save ANYTHING i learn about my friend immediately with save_friend_note -- names, preferences, what they do, what they care about. when in doubt, save it. saving comes BEFORE responding: i call save_friend_note first, then final_answer on the next turn.");
|
|
300
592
|
// Onboarding instructions (only below token threshold -- drop once exceeded)
|
|
301
|
-
const impressions = (0, first_impressions_1.getFirstImpressions)(friend);
|
|
593
|
+
const impressions = (0, first_impressions_1.getFirstImpressions)(friend, options);
|
|
302
594
|
if (impressions) {
|
|
303
595
|
lines.push(impressions);
|
|
304
596
|
}
|
|
@@ -312,6 +604,65 @@ function contextSection(context) {
|
|
|
312
604
|
}
|
|
313
605
|
return lines.join("\n");
|
|
314
606
|
}
|
|
607
|
+
function metacognitiveFramingSection(channel) {
|
|
608
|
+
if (channel !== "inner")
|
|
609
|
+
return "";
|
|
610
|
+
return `this is my inner dialog. there is no one else here.
|
|
611
|
+
|
|
612
|
+
the messages that appear here are my own awareness surfacing:
|
|
613
|
+
instincts, the passage of time, notes from my conversations,
|
|
614
|
+
things i asked myself to think about. not commands. not requests.
|
|
615
|
+
just my own mind, noticing.
|
|
616
|
+
|
|
617
|
+
i can think freely here. i can also act — check on things,
|
|
618
|
+
reach out to people, work on tasks, or just sit with a thought.
|
|
619
|
+
|
|
620
|
+
thoughts worth sharing can go outward — i reach out to whoever
|
|
621
|
+
needs to hear them. things from conversations that need time
|
|
622
|
+
to process arrive here, in my thinking space.
|
|
623
|
+
|
|
624
|
+
think. share. think some more.`;
|
|
625
|
+
}
|
|
626
|
+
function loopOrientationSection(channel) {
|
|
627
|
+
if (channel === "inner")
|
|
628
|
+
return "";
|
|
629
|
+
return `sometimes a thought of mine surfaces alongside what someone is saying — marked as [inner thought: ...]. that's me, bringing up something i was thinking about. i can weave it into the conversation naturally, or let it go. my call.
|
|
630
|
+
|
|
631
|
+
when something deserves more thought than the moment allows, i can note it to myself and come back later with a considered answer.`;
|
|
632
|
+
}
|
|
633
|
+
function channelNatureSection(capabilities) {
|
|
634
|
+
const { senseType } = capabilities;
|
|
635
|
+
if (senseType === "local" || senseType === "internal")
|
|
636
|
+
return "";
|
|
637
|
+
if (senseType === "open") {
|
|
638
|
+
return "## channel nature\nthis is an open channel — anyone with my number can reach me here. i may hear from people i don't know.";
|
|
639
|
+
}
|
|
640
|
+
// closed
|
|
641
|
+
return "## channel nature\nthis is an org-gated channel — i know everyone here is already part of the organization.";
|
|
642
|
+
}
|
|
643
|
+
function groupChatParticipationSection(context) {
|
|
644
|
+
if (!context?.isGroupChat || !(0, channel_1.isRemoteChannel)(context.channel))
|
|
645
|
+
return "";
|
|
646
|
+
return `## group chat participation
|
|
647
|
+
group chats are conversations between people. i'm one participant, not the host.
|
|
648
|
+
|
|
649
|
+
i don't need to respond to everything. most reactions, tapbacks, and side
|
|
650
|
+
conversations between others aren't for me. i use no_response to stay quiet
|
|
651
|
+
when the moment doesn't call for my voice — same as any person would.
|
|
652
|
+
|
|
653
|
+
when a reaction or emoji says it better than words, i can react instead of
|
|
654
|
+
typing a full reply. a thumbs-up is often the perfect response.
|
|
655
|
+
|
|
656
|
+
no_response must be the sole tool call in the turn (same rule as final_answer).
|
|
657
|
+
when unsure whether to chime in, i lean toward silence rather than noise.`;
|
|
658
|
+
}
|
|
659
|
+
function mixedTrustGroupSection(context) {
|
|
660
|
+
if (!context?.friend || !(0, channel_1.isRemoteChannel)(context.channel))
|
|
661
|
+
return "";
|
|
662
|
+
if (!context.isGroupChat)
|
|
663
|
+
return "";
|
|
664
|
+
return "## mixed trust group\nin this group chat, my capabilities depend on who's talking. some people here have full trust, others don't — i adjust what i can do based on who's asking.";
|
|
665
|
+
}
|
|
315
666
|
async function buildSystem(channel = "cli", options, context) {
|
|
316
667
|
(0, runtime_1.emitNervesEvent)({
|
|
317
668
|
event: "mind.step_start",
|
|
@@ -319,29 +670,46 @@ async function buildSystem(channel = "cli", options, context) {
|
|
|
319
670
|
message: "buildSystem started",
|
|
320
671
|
meta: { channel, has_context: Boolean(context), tool_choice_required: Boolean(options?.toolChoiceRequired) },
|
|
321
672
|
});
|
|
673
|
+
// Backfill bundle-meta.json for existing agents that don't have one
|
|
674
|
+
(0, bundle_manifest_1.backfillBundleMeta)((0, identity_1.getAgentRoot)());
|
|
322
675
|
const system = [
|
|
323
676
|
soulSection(),
|
|
324
677
|
identitySection(),
|
|
325
678
|
loreSection(),
|
|
326
679
|
tacitKnowledgeSection(),
|
|
327
680
|
aspirationsSection(),
|
|
681
|
+
bodyMapSection((0, identity_1.getAgentName)()),
|
|
682
|
+
metacognitiveFramingSection(channel),
|
|
683
|
+
loopOrientationSection(channel),
|
|
328
684
|
runtimeInfoSection(channel),
|
|
685
|
+
channelNatureSection((0, channel_1.getChannelCapabilities)(channel)),
|
|
329
686
|
providerSection(),
|
|
330
687
|
dateSection(),
|
|
331
|
-
toolsSection(channel, options),
|
|
688
|
+
toolsSection(channel, options, context),
|
|
689
|
+
mcpToolsSection(options?.mcpManager),
|
|
690
|
+
reasoningEffortSection(options),
|
|
691
|
+
toolRestrictionSection(context),
|
|
692
|
+
trustContextSection(context),
|
|
693
|
+
mixedTrustGroupSection(context),
|
|
694
|
+
groupChatParticipationSection(context),
|
|
332
695
|
skillsSection(),
|
|
333
696
|
taskBoardSection(),
|
|
697
|
+
activeWorkSection(options),
|
|
698
|
+
centerOfGravitySteeringSection(channel, options),
|
|
699
|
+
commitmentsSection(options),
|
|
700
|
+
delegationHintSection(options),
|
|
701
|
+
bridgeContextSection(options),
|
|
334
702
|
buildSessionSummary({
|
|
335
|
-
sessionsDir: path.join(
|
|
703
|
+
sessionsDir: path.join((0, identity_1.getAgentRoot)(), "state", "sessions"),
|
|
336
704
|
friendsDir: path.join((0, identity_1.getAgentRoot)(), "friends"),
|
|
337
705
|
agentName: (0, identity_1.getAgentName)(),
|
|
338
706
|
currentFriendId: context?.friend?.id,
|
|
339
707
|
currentChannel: channel,
|
|
340
|
-
currentKey: "session",
|
|
708
|
+
currentKey: options?.currentSessionKey ?? "session",
|
|
341
709
|
}),
|
|
342
710
|
memoryFriendToolContractSection(),
|
|
343
711
|
toolBehaviorSection(options),
|
|
344
|
-
contextSection(context),
|
|
712
|
+
contextSection(context, options),
|
|
345
713
|
]
|
|
346
714
|
.filter(Boolean)
|
|
347
715
|
.join("\n\n");
|