@ouro.bot/cli 0.1.0-alpha.1179 → 0.1.0-alpha.1180

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/changelog.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1180",
6
+ "changes": [
7
+ "Ouroboros says it messages sessions as a relayed peer, opens repository work as project sessions, and passes a why with every Shepherd write."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1179",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1179",
2
+ "runtimeVersion": "0.1.0-alpha.1180",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1179</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1180</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -72,6 +72,12 @@ function bodyOf(args, ...skip) {
72
72
  const body = Object.fromEntries(Object.entries(args).filter(([key]) => !skip.includes(key)));
73
73
  return Object.keys(body).length ? body : undefined;
74
74
  }
75
+ /** The `--why` Shepherd records with a write verb: what Ouroboros is doing, then the intent already in the call (a message, a prompt), kept to one line. */
76
+ function because(action, ...detail) {
77
+ const gist = (value) => (typeof value === "string" ? value.replace(/\s+/g, " ").trim().slice(0, 120) : "");
78
+ return { why: [action, ...detail.map(gist).filter(Boolean)].join(": ") };
79
+ }
80
+ const short = (id) => String(id).slice(0, 8);
75
81
  /** Whether a watch answers the session's replies: `never` does not, `always` keeps watching for a day, `once` (the default) stops at the first reply. */
76
82
  const watchMode = (value) => (value === "never" ? null : value === "always" ? "always" : "once");
77
83
  function define(name, description, properties, required, risk, body, summaryKeys = []) {
@@ -102,18 +108,18 @@ exports.listSessionsAndChatsTool = define("list_sessions_and_chats", "Every open
102
108
  });
103
109
  exports.getSessionsStatusTool = define("get_sessions_status", "What every session is doing now, with counts: busy, idle, stuck, blocked, and what each blocked one waits on. awaiting_input carries the request_id and the question that answer_session_input or respond_to_session_plan_v2 needs. Read-only.", { state: { type: "string", enum: ["busy", "idle", "waiting", "stuck"], description: "Only sessions in this state." } }, [], READ, args => (0, shepherd_cli_1.shepherd)(["sessions", ...(typeof args.state === "string" ? ["--state", args.state] : [])]), ["state"]);
104
110
  exports.getSessionTool = define("get_session", "One session's details and what it is doing now, including what it waits on (awaiting_input). Read-only.", { session_id: session }, ["session_id"], READ, args => (0, shepherd_cli_1.shepherd)(["session", sessionId(args)]), ["session_id"]);
105
- exports.sendSessionMessageTool = define("send_session_message", "Send a message into a session, as its message box does; waits up to 2 minutes for the app to accept it (a session that is not loaded loads first). The app takes it for the person's, so say who you are in it. immediate (default) is admitted at the session's next turn boundary; enqueue waits behind its work.", { session_id: session, message: { type: "string", description: "What to send." }, delivery_mode: { type: "string", enum: ["immediate", "enqueue"] }, notify_on_idle: notifyOnIdle }, ["session_id", "message"], write("sends a message into another agent session in the owner's Copilot app"), async (args, agentRoot) => {
111
+ exports.sendSessionMessageTool = define("send_session_message", "Send a message to a session as a peer: the session sees it as a cross-session message from Ouroboros (Shepherd's own Ouroboros session is the sender and relays it, so the sender is not this runtime itself), never as the owner's turn. Write as yourself, Ouroboros, not as the owner or the owner's agent; the sender already says who you are. Replies come back to that Ouroboros session (read it with shepherd messages). Waits up to 2 minutes for the app to accept it (a session that is not loaded loads first). immediate (default) is admitted at the session's next turn boundary; enqueue waits behind its work.", { session_id: session, message: { type: "string", description: "What to send." }, delivery_mode: { type: "string", enum: ["immediate", "enqueue"] }, notify_on_idle: notifyOnIdle }, ["session_id", "message"], write("sends a message into another agent session in the owner's Copilot app"), async (args, agentRoot) => {
106
112
  // The session is resolved and the send time taken before the send, so the watch's cursor sits before any reply to it.
107
113
  const row = await (0, shepherd_cli_1.shepherd)(["session", sessionId(args)]);
108
114
  const id = String(row.id);
109
115
  const mode = watchMode(args.notify_on_idle);
110
116
  const sentAt = new Date().toISOString();
111
- const sent = await (0, shepherd_cli_1.shepherd)(["send", id], bodyOf(args, "session_id", "notify_on_idle"));
117
+ const sent = await (0, shepherd_cli_1.shepherd)(["send", id], bodyOf(args, "session_id", "notify_on_idle"), because(`Ouroboros messages ${String(row.name)}`, args.message));
112
118
  if (mode !== null)
113
119
  (0, store_1.watchSession)(agentRoot, id, String(row.name), sentAt, Date.now(), mode === "once");
114
120
  return { ...sent, watching: mode !== null };
115
121
  }, ["session_id"]);
116
- exports.createSessionTool = define("create_session", "Start a session. With project_id (a project's id or name): a project session in its own worktree (workspace_type branch uses the project's checkout instead), kicked off with kickoff.prompt and allow-all permissions unless kickoff.permission_mode says otherwise. Without it: a standalone chat. Waits for the session to exist (a worktree takes about two minutes). It has no coordinator: the app does not let an outside client be one. You may archive what you create.", {
122
+ exports.createSessionTool = define("create_session", "Start a session. With project_id (a project's id or name): a project session in its own worktree (workspace_type branch uses the project's checkout instead), kicked off with kickoff.prompt and allow-all permissions unless kickoff.permission_mode says otherwise. Without it: a standalone chat, which shows to peers as \"General Chat\" and has no repository, so use it only for talk that is not repository work. Any work in a repository (for the harness itself: the ouroboros project) must pass project_id, never a chat. Waits for the session to exist (a worktree takes about two minutes). It has no coordinator: the app does not let an outside client be one. You may archive what you create.", {
117
123
  name: { type: "string", description: "Sidebar title." }, project_id: { type: "string", description: "The project's id or name." }, session_kind: { type: "string", enum: ["chat", "project"] },
118
124
  workspace_type: { type: "string", enum: ["worktree", "branch"] }, branch_name: { type: "string", description: "Branch for a worktree; a fresh ouro-… name by default." },
119
125
  kickoff: {
@@ -125,21 +131,21 @@ exports.createSessionTool = define("create_session", "Start a session. With proj
125
131
  },
126
132
  notify_on_idle: notifyOnIdle,
127
133
  }, [], write("opens a new agent session in the owner's Copilot app"), async (args, agentRoot) => {
128
- const created = await (0, shepherd_cli_1.shepherd)(["create"], bodyOf(args, "notify_on_idle"));
129
- const mode = watchMode(args.notify_on_idle);
130
134
  const kickoff = (args.kickoff && typeof args.kickoff === "object" ? args.kickoff : {});
135
+ const created = await (0, shepherd_cli_1.shepherd)(["create"], bodyOf(args, "notify_on_idle"), because(`Ouroboros opens ${typeof args.name === "string" && args.name ? args.name : "a session"}`, kickoff.prompt));
136
+ const mode = watchMode(args.notify_on_idle);
131
137
  const prompted = Boolean(kickoff.prompt);
132
138
  // A new session has no replies before this, so its first one is read from the time it was made.
133
139
  if (prompted && mode !== null)
134
140
  (0, store_1.watchSession)(agentRoot, String(created.session_id), typeof args.name === "string" ? args.name : null, new Date().toISOString(), Date.now(), mode === "once");
135
141
  return prompted ? { ...created, watching: mode !== null } : created;
136
142
  }, ["name"]);
137
- exports.answerSessionInputTool = define("answer_session_input", "Answer the question a session asked with ask_user and is blocked on. get_session shows it (awaiting_input.question, choices). A choice or free text. A question asked while this agent was not connected has no request id and cannot be answered here.", { session_id: session, answer: { type: "string" } }, ["session_id", "answer"], write("answers a question for the person in another agent session"), args => (0, shepherd_cli_1.shepherd)(["answer", sessionId(args)], bodyOf(args, "session_id")), ["session_id"]);
138
- exports.respondToSessionPlanTool = define("respond_to_session_plan_v2", "Approve or reject the plan a session paused on (awaiting_plan_approval). feedback is sent to the session as a message after the decision.", { session_id: session, approved: { type: "boolean" }, selected_action: { type: "string", description: "One of awaiting_input.actions; the recommended one by default." }, feedback: { type: "string" } }, ["session_id", "approved"], write("approves or rejects another agent session's plan for the person"), args => (0, shepherd_cli_1.shepherd)(["plan", sessionId(args)], bodyOf(args, "session_id")), ["session_id"]);
143
+ exports.answerSessionInputTool = define("answer_session_input", "Answer the question a session asked with ask_user and is blocked on. get_session shows it (awaiting_input.question, choices). A choice or free text. A question asked while this agent was not connected has no request id and cannot be answered here.", { session_id: session, answer: { type: "string" } }, ["session_id", "answer"], write("answers a question for the person in another agent session"), args => (0, shepherd_cli_1.shepherd)(["answer", sessionId(args)], bodyOf(args, "session_id"), because(`Ouroboros answers the question session ${short(args.session_id)} asked`, args.answer)), ["session_id"]);
144
+ exports.respondToSessionPlanTool = define("respond_to_session_plan_v2", "Approve or reject the plan a session paused on (awaiting_plan_approval). feedback is sent to the session as a message after the decision.", { session_id: session, approved: { type: "boolean" }, selected_action: { type: "string", description: "One of awaiting_input.actions; the recommended one by default." }, feedback: { type: "string" } }, ["session_id", "approved"], write("approves or rejects another agent session's plan for the person"), args => (0, shepherd_cli_1.shepherd)(["plan", sessionId(args)], bodyOf(args, "session_id"), because(`Ouroboros ${args.approved === true ? "approves" : "rejects"} the plan of session ${short(args.session_id)}`, args.feedback)), ["session_id"]);
139
145
  exports.archiveSessionTool = define("archive_session", "Archive a session you created with create_session (a project session's worktree goes with it). A session you did not create is archived only when the owner asked for that session in this conversation (owner_asked: true) or when it is over the size limit and a newer session names it as handed off. Archiving can be undone, and each such archive is logged and shown in the next digest.", { session_id: session, owner_asked: { type: "boolean", description: "True only when the owner asked in this conversation for this session to be archived." } }, ["session_id"], write("archives a session in the owner's Copilot app"), async (args, agentRoot) => {
140
146
  const ownerAsked = args.owner_asked === true;
141
147
  const row = await (0, shepherd_cli_1.shepherd)(["session", sessionId(args)]);
142
- const archived = await (0, shepherd_cli_1.shepherd)(["archive", String(row.id)], ownerAsked ? { owner_asked: true } : undefined);
148
+ const archived = await (0, shepherd_cli_1.shepherd)(["archive", String(row.id)], ownerAsked ? { owner_asked: true } : undefined, because(ownerAsked ? `The owner asked Ouroboros to archive ${String(row.name)}` : `Ouroboros archives ${String(row.name)}, which it created or which was handed off`));
143
149
  // Shepherd logs the archives it makes itself; the owner-asked ones are logged here for the digest.
144
150
  if (ownerAsked)
145
151
  (0, store_1.addArchiveLog)(agentRoot, { id: String(row.id), name: String(row.name), at: new Date().toISOString(), reason: "owner-asked" });
@@ -150,10 +156,13 @@ exports.saveSessionAutomationTool = define("save_session_automation", "Create or
150
156
  session_id: session, prompt: { type: "string" }, interval: { type: "string", enum: ["once", "minutes", "daily", "weekly", "cron"] }, run_at: { type: "string" }, every_minutes: { type: "number" },
151
157
  schedule_hour: { type: "number" }, schedule_minute: { type: "number" }, schedule_day: { type: "number" }, cron_expression: { type: "string" }, name: { type: "string" },
152
158
  clear: { type: "boolean", description: "Remove the session's automation instead." },
153
- }, ["session_id"], write("schedules wake-ups for an agent session in the owner's Copilot app"), args => (0, shepherd_cli_1.shepherd)(["automation", sessionId(args)], bodyOf(args, "session_id")), ["session_id"]);
159
+ }, ["session_id"], write("schedules wake-ups for an agent session in the owner's Copilot app"), args => {
160
+ const body = bodyOf(args, "session_id");
161
+ return (0, shepherd_cli_1.shepherd)(["automation", sessionId(args)], body, body ? because(args.clear === true ? `Ouroboros clears the wake-ups of session ${short(args.session_id)}` : `Ouroboros schedules a wake-up for session ${short(args.session_id)}`, args.prompt) : {});
162
+ }, ["session_id"]);
154
163
  exports.getSessionAutomationTool = define("get_session_automation", "The automation attached to a session. Read-only.", { session_id: session }, ["session_id"], READ, args => (0, shepherd_cli_1.shepherd)(["automation", sessionId(args)]), ["session_id"]);
155
164
  exports.listWorkflowsTool = define("list_workflows", "The app's automations (workflows), with their ids and schedules. Read-only.", {}, [], READ, () => (0, shepherd_cli_1.shepherd)(["workflows"]));
156
- exports.runWorkflowTool = define("run_workflow", "Run one of the app's automations now, in a new session.", { id: { type: "string", description: "From list_workflows." } }, ["id"], write("starts a session in the owner's Copilot app"), args => (0, shepherd_cli_1.shepherd)(["run-workflow", String(args.id)]), ["id"]);
165
+ exports.runWorkflowTool = define("run_workflow", "Run one of the app's automations now, in a new session.", { id: { type: "string", description: "From list_workflows." } }, ["id"], write("starts a session in the owner's Copilot app"), args => (0, shepherd_cli_1.shepherd)(["run-workflow", String(args.id)], undefined, because(`Ouroboros runs workflow ${String(args.id)}`)), ["id"]);
157
166
  exports.appSessionsTailTool = define("app_sessions_tail", "A session's last visible prompts and replies, oldest first, with its current name and state and how much of the local log was read. Re-read before reporting current progress: older messages are not live status. Read-only.", { session_id: session, count: { type: "number", description: "How many messages, 1-50. Default 6." } }, ["session_id"], READ, async (args, agentRoot) => {
158
167
  const history = await (0, shepherd_cli_1.shepherd)(["messages", sessionId(args)], { count: Math.min(50, Math.max(1, Math.trunc(Number(args.count) || 6))) });
159
168
  const watchedName = (0, store_1.readWatches)(agentRoot)[String(history.session_id)]?.name;
@@ -149,7 +149,8 @@ async function shepherd(verb, input, options = {}) {
149
149
  const command = resolveShepherd(options.env, options.home);
150
150
  if (!command)
151
151
  throw new ShepherdUnavailableError("Shepherd is not installed, so the GitHub Copilot app's sessions cannot be reached");
152
- const args = [...verb, "--json", ...(input === undefined ? [] : ["--input", "-"])];
152
+ const why = options.why?.replace(/\s+/g, " ").trim().slice(0, 300);
153
+ const args = [...verb, "--json", ...(why ? ["--why", why] : []), ...(input === undefined ? [] : ["--input", "-"])];
153
154
  const { code, stdout, stderr } = await runCommand(command, args, input === undefined ? null : JSON.stringify(input), options.timeoutMs ?? SHEPHERD_TIMEOUT_MS);
154
155
  const parsed = jsonResult(stdout);
155
156
  if (code !== 0 || parsed?.ok === false) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1179",
3
+ "version": "0.1.0-alpha.1180",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.1179",
9
+ "version": "0.1.0-alpha.1180",
10
10
  "bundleDependencies": [
11
11
  "@ouro.bot/friends"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1179",
3
+ "version": "0.1.0-alpha.1180",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },