@stratusagent/agents 0.13.5 → 0.13.7

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/dist/index.d.ts CHANGED
@@ -7,7 +7,8 @@ export { type AgentRouteRule, type AgentRouter, createAgentRouter, createAgentTe
7
7
  export { MEMORY_TOOL_NAME, createRememberTool, RECALL_TOOL_NAME, createRecallTool, FORGET_TOOL_NAME, createForgetTool, PIN_TOOL_NAME, createPinTool, type MemoryToolOptions, } from './tools/memory.ts';
8
8
  export { DELEGATE_TOOL_NAME, DELEGATED_BY_METADATA_KEY, ROOT_SESSION_ID_METADATA_KEY, DELEGATION_DEPTH_METADATA_KEY, DELEGATED_SESSION_ID_MARKER, DEFAULT_MAX_DELEGATION_DEPTH, isDelegatedSession, delegatingSessionIdOf, outstandingDelegationFor, withoutDelegation, type DelegateDispatch, type DelegateToolOptions, createDelegateTool, } from './tools/delegate.ts';
9
9
  export { SCHEDULE_EVERY_TOOL_NAME, SCHEDULE_AT_TOOL_NAME, SCHEDULE_LIST_TOOL_NAME, SCHEDULE_CANCEL_TOOL_NAME, createScheduleTools, } from './tools/schedule.ts';
10
- export { MESSAGE_SEND_TOOL_NAME, type OutboundMessenger, createMessageSendTool, type DefaultThreadResolver, MESSAGE_READ_TOOL_NAME, MESSAGE_READ_MAX_LIMIT, MESSAGE_READ_TEXT_BUDGET, type ConversationReader, type ConversationReadRefusal, createMessageReadTool, directMessageReadRefusal, } from './tools/message.ts';
10
+ export { MESSAGE_SEND_TOOL_NAME, type OutboundMessenger, createMessageSendTool, type DefaultThreadResolver, MESSAGE_READ_TOOL_NAME, MESSAGE_READ_MAX_LIMIT, MESSAGE_READ_BOOKMARK_BUDGET, MESSAGE_READ_TEXT_BUDGET, type ConversationReader, type ConversationReadRefusal, createMessageReadTool, directMessageReadRefusal, } from './tools/message.ts';
11
+ export { CHANNEL_CREATE_TOOL_NAME, type ConversationCreator, createChannelCreateTool, } from './tools/channel.ts';
11
12
  export { CREDENTIAL_REQUEST_TOOL_NAME, type CredentialRequester, createCredentialRequestTool, } from './tools/credentials.ts';
12
13
  export { GATEWAY_ONLY_TOOL_NAMES } from './tools/gateway-only.ts';
13
14
  export { loadStratusSkill, STRATUS_SKILL_PATH } from './builtin-skills.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,KAAK,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EACL,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,SAAS,EACT,UAAU,GACX,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,4BAA4B,EAC5B,8BAA8B,EAC9B,KAAK,mBAAmB,EACxB,kBAAkB,EAClB,KAAK,4BAA4B,EACjC,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,cAAc,EACnB,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,KAAK,mBAAmB,EACxB,oBAAoB,EACpB,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,2BAA2B,EAC3B,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,iBAAiB,EACjB,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,g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AAqB,CAAC;AAE7B,OAAO,EACL,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,4BAA4B,EAC5B,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,4BAA4B,EAC5B,KAAK,mBAAmB,EACxB,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -12,7 +12,8 @@ export { createAgentRouter, createAgentTeam, } from "./router.js";
12
12
  export { MEMORY_TOOL_NAME, createRememberTool, RECALL_TOOL_NAME, createRecallTool, FORGET_TOOL_NAME, createForgetTool, PIN_TOOL_NAME, createPinTool, } from "./tools/memory.js";
13
13
  export { DELEGATE_TOOL_NAME, DELEGATED_BY_METADATA_KEY, ROOT_SESSION_ID_METADATA_KEY, DELEGATION_DEPTH_METADATA_KEY, DELEGATED_SESSION_ID_MARKER, DEFAULT_MAX_DELEGATION_DEPTH, isDelegatedSession, delegatingSessionIdOf, outstandingDelegationFor, withoutDelegation, createDelegateTool, } from "./tools/delegate.js";
14
14
  export { SCHEDULE_EVERY_TOOL_NAME, SCHEDULE_AT_TOOL_NAME, SCHEDULE_LIST_TOOL_NAME, SCHEDULE_CANCEL_TOOL_NAME, createScheduleTools, } from "./tools/schedule.js";
15
- export { MESSAGE_SEND_TOOL_NAME, createMessageSendTool, MESSAGE_READ_TOOL_NAME, MESSAGE_READ_MAX_LIMIT, MESSAGE_READ_TEXT_BUDGET, createMessageReadTool, directMessageReadRefusal, } from "./tools/message.js";
15
+ export { MESSAGE_SEND_TOOL_NAME, createMessageSendTool, MESSAGE_READ_TOOL_NAME, MESSAGE_READ_MAX_LIMIT, MESSAGE_READ_BOOKMARK_BUDGET, MESSAGE_READ_TEXT_BUDGET, createMessageReadTool, directMessageReadRefusal, } from "./tools/message.js";
16
+ export { CHANNEL_CREATE_TOOL_NAME, createChannelCreateTool, } from "./tools/channel.js";
16
17
  export { CREDENTIAL_REQUEST_TOOL_NAME, createCredentialRequestTool, } from "./tools/credentials.js";
17
18
  export { GATEWAY_ONLY_TOOL_NAMES } from "./tools/gateway-only.js";
18
19
  export { loadStratusSkill, STRATUS_SKILL_PATH } from "./builtin-skills.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,wEAAwE;AACxE,wEAAwE;AACxE,mEAAmE;AACnE,mDAAmD;AAEnD,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAyB,WAAW,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EACL,iBAAiB,EAGjB,SAAS,EACT,UAAU,GACX,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,4BAA4B,EAC5B,8BAA8B,EAE9B,kBAAkB,EAGlB,qBAAqB,EAErB,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,OAAO,EAEL,oBAAoB,EACpB,gBAAgB,EAGhB,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,2BAA2B,EAG3B,gBAAgB,GACjB,MAAM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OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,44 @@
1
+ import type { Tool } from '@stratusagent/core';
2
+ export declare const CHANNEL_CREATE_TOOL_NAME = "channel.create";
3
+ /**
4
+ * Creates one conversation through the agent's own channel app. The
5
+ * gateway implements it over the channel contract's `createConversation`,
6
+ * structurally mirrored here the way `ConversationReader` mirrors
7
+ * `readConversation`; rejecting is how a channel says it will not.
8
+ */
9
+ export type ConversationCreator = (input: {
10
+ agentId: string;
11
+ /** The channel kind, e.g. `slack`. */
12
+ channel: string;
13
+ name: string;
14
+ private?: boolean;
15
+ topic?: string;
16
+ purpose?: string;
17
+ /** Channel-native user ids, or agent ids the channel resolves to their app. */
18
+ invite?: string[];
19
+ }) => Promise<{
20
+ conversation: string;
21
+ name: string;
22
+ invited: string[];
23
+ notInvited: Array<{
24
+ who: string;
25
+ reason: string;
26
+ }>;
27
+ notSet: Array<{
28
+ field: 'topic' | 'purpose';
29
+ reason: string;
30
+ }>;
31
+ }>;
32
+ /**
33
+ * Create a channel and invite people and other agents to it, so an agent
34
+ * can set up a client or project room without a person doing it by hand.
35
+ *
36
+ * `gated`, like `message.send`: a new channel and its invitations are seen
37
+ * by everyone invited, and a channel cannot be taken back by the agent.
38
+ * There is no destination to judge by before the channel exists, so a
39
+ * durable grant is a standing yes to creating channels. The channel's own
40
+ * app does the work with its own token, which never reaches the agent; the
41
+ * channel decides what its app may create.
42
+ */
43
+ export declare const createChannelCreateTool: (create: ConversationCreator) => Tool;
44
+ //# sourceMappingURL=channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../src/tools/channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAuB,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAEpE,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,KAAK,OAAO,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/D,CAAC,CAAC;AAaH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,GAAI,QAAQ,mBAAmB,KAAG,IAkEpE,CAAC"}
@@ -0,0 +1,90 @@
1
+ export const CHANNEL_CREATE_TOOL_NAME = 'channel.create';
2
+ const optionalText = (input, key) => {
3
+ const value = input[key];
4
+ if (value === undefined || value === null) {
5
+ return undefined;
6
+ }
7
+ if (typeof value !== 'string') {
8
+ throw new Error(`${CHANNEL_CREATE_TOOL_NAME}: "${key}" must be a string when given.`);
9
+ }
10
+ return value.trim() || undefined;
11
+ };
12
+ /**
13
+ * Create a channel and invite people and other agents to it, so an agent
14
+ * can set up a client or project room without a person doing it by hand.
15
+ *
16
+ * `gated`, like `message.send`: a new channel and its invitations are seen
17
+ * by everyone invited, and a channel cannot be taken back by the agent.
18
+ * There is no destination to judge by before the channel exists, so a
19
+ * durable grant is a standing yes to creating channels. The channel's own
20
+ * app does the work with its own token, which never reaches the agent; the
21
+ * channel decides what its app may create.
22
+ */
23
+ export const createChannelCreateTool = (create) => ({
24
+ name: CHANNEL_CREATE_TOOL_NAME,
25
+ description: 'Create a channel through your own app, optionally private, with a topic and purpose, and invite people and other agents to it. '
26
+ + 'invite takes the channel\'s user ids (for Slack, U…) and other agents\' ids on this host, which resolve to their apps. '
27
+ + 'Returns the new conversation id. The channel is kept even if some invites or the topic fail: '
28
+ + 'notInvited and notSet say what did not happen and why, so report those rather than retrying the create. '
29
+ + 'For Slack, names are lowercase letters, numbers, hyphens and underscores, at most 80 characters.',
30
+ risk: 'gated',
31
+ parameters: {
32
+ type: 'object',
33
+ properties: {
34
+ channel: { type: 'string', description: 'The channel kind to create it in, e.g. "slack".' },
35
+ name: { type: 'string', description: 'The new channel\'s name, without a leading #.' },
36
+ private: { type: 'boolean', description: 'Create a private channel. Public by default.' },
37
+ topic: { type: 'string', description: 'The channel\'s topic.' },
38
+ purpose: { type: 'string', description: 'The channel\'s purpose (its description).' },
39
+ invite: {
40
+ type: 'array',
41
+ items: { type: 'string' },
42
+ description: 'Who to invite: user ids, or agent ids on this host. Your own app is already a member.',
43
+ },
44
+ },
45
+ required: ['channel', 'name'],
46
+ },
47
+ async execute(input, session) {
48
+ const channel = typeof input.channel === 'string' ? input.channel.trim() : '';
49
+ if (!channel) {
50
+ throw new Error(`${CHANNEL_CREATE_TOOL_NAME} requires "channel", the channel kind (e.g. "slack").`);
51
+ }
52
+ const name = typeof input.name === 'string' ? input.name.trim() : '';
53
+ if (!name) {
54
+ throw new Error(`${CHANNEL_CREATE_TOOL_NAME} requires a non-empty "name".`);
55
+ }
56
+ if (input.private !== undefined && typeof input.private !== 'boolean') {
57
+ throw new Error(`${CHANNEL_CREATE_TOOL_NAME}: "private" must be true or false.`);
58
+ }
59
+ const topic = optionalText(input, 'topic');
60
+ const purpose = optionalText(input, 'purpose');
61
+ let invite;
62
+ if (input.invite !== undefined && input.invite !== null) {
63
+ const raw = input.invite;
64
+ if (!Array.isArray(raw) || raw.some((entry) => typeof entry !== 'string' || entry.trim().length === 0)) {
65
+ throw new Error(`${CHANNEL_CREATE_TOOL_NAME}: "invite" must be a list of non-empty ids.`);
66
+ }
67
+ const unique = [...new Set(raw.map((entry) => entry.trim()))];
68
+ invite = unique.length > 0 ? unique : undefined;
69
+ }
70
+ const result = await create({
71
+ agentId: session.agent.id,
72
+ channel,
73
+ name,
74
+ ...(input.private === true ? { private: true } : {}),
75
+ ...(topic !== undefined ? { topic } : {}),
76
+ ...(purpose !== undefined ? { purpose } : {}),
77
+ ...(invite !== undefined ? { invite } : {}),
78
+ });
79
+ return {
80
+ created: true,
81
+ channel,
82
+ conversation: result.conversation,
83
+ name: result.name,
84
+ invited: [...result.invited],
85
+ notInvited: result.notInvited.map(({ who, reason }) => ({ who, reason })),
86
+ notSet: result.notSet.map(({ field, reason }) => ({ field, reason })),
87
+ };
88
+ },
89
+ });
90
+ //# sourceMappingURL=channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channel.js","sourceRoot":"","sources":["../../src/tools/channel.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,wBAAwB,GAAG,gBAAgB,CAAC;AA0BzD,MAAM,YAAY,GAAG,CAAC,KAAiB,EAAE,GAAW,EAAsB,EAAE;IAC1E,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC1C,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,GAAG,wBAAwB,MAAM,GAAG,gCAAgC,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC;AACnC,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MA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,CAAC"}
1
+ {"version":3,"file":"gateway-only.d.ts","sourceRoot":"","sources":["../../src/tools/gateway-only.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAUpD,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { CHANNEL_CREATE_TOOL_NAME } from "./channel.js";
1
2
  import { CREDENTIAL_REQUEST_TOOL_NAME } from "./credentials.js";
2
3
  import { DELEGATE_TOOL_NAME } from "./delegate.js";
3
4
  import { MESSAGE_READ_TOOL_NAME, MESSAGE_SEND_TOOL_NAME } from "./message.js";
@@ -26,6 +27,7 @@ export const GATEWAY_ONLY_TOOL_NAMES = [
26
27
  SCHEDULE_CANCEL_TOOL_NAME,
27
28
  MESSAGE_SEND_TOOL_NAME,
28
29
  MESSAGE_READ_TOOL_NAME,
30
+ CHANNEL_CREATE_TOOL_NAME,
29
31
  DELEGATE_TOOL_NAME,
30
32
  CREDENTIAL_REQUEST_TOOL_NAME,
31
33
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"gateway-only.js","sourceRoot":"","sources":["../../src/tools/gateway-only.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAsB;IACxD,wBAAwB;IACxB,qBAAqB;IACrB,uBAAuB;IACvB,yBAAyB;IACzB,sBAAsB;IACtB,sBAAsB;IACtB,kBAAkB;IAClB,4BAA4B;CAC7B,CAAC"}
1
+ {"version":3,"file":"gateway-only.js","sourceRoot":"","sources":["../../src/tools/gateway-only.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAsB;IACxD,wBAAwB;IACxB,qBAAqB;IACrB,uBAAuB;IACvB,yBAAyB;IACzB,sBAAsB;IACtB,sBAAsB;IACtB,wBAAwB;IACxB,kBAAkB;IAClB,4BAA4B;CAC7B,CAAC"}
@@ -60,6 +60,14 @@ export declare const MESSAGE_READ_MAX_LIMIT = 200;
60
60
  * agent pages on with `before`/`after`.
61
61
  */
62
62
  export declare const MESSAGE_READ_TEXT_BUDGET = 40000;
63
+ /**
64
+ * The share of `MESSAGE_READ_TEXT_BUDGET` a channel's bookmarks may take,
65
+ * counted first. It holds Slack's limit of 100 at a typical length; what
66
+ * it exists to stop is the people in a channel filling the agent's context
67
+ * with bookmarks. The ones that do not fit are counted, not paged: Slack
68
+ * lists them all in one call.
69
+ */
70
+ export declare const MESSAGE_READ_BOOKMARK_BUDGET = 16000;
63
71
  /**
64
72
  * Reads one conversation, or one thread in it, through the agent's own
65
73
  * channel app. The gateway implements it over the channel contract's
@@ -68,6 +76,8 @@ export declare const MESSAGE_READ_TEXT_BUDGET = 40000;
68
76
  */
69
77
  export type ConversationReader = (input: {
70
78
  agentId: string;
79
+ /** The session reading: a direct message is readable only from its own. */
80
+ sessionId: string;
71
81
  source: ScheduleDestination;
72
82
  thread?: string;
73
83
  after?: string;
@@ -85,6 +95,12 @@ export type ConversationReader = (input: {
85
95
  files?: string[];
86
96
  }>;
87
97
  more: boolean;
98
+ bookmarks?: Array<{
99
+ title: string;
100
+ link: string;
101
+ }>;
102
+ bookmarksUnavailable?: string;
103
+ bookmarksOmitted?: number;
88
104
  }>;
89
105
  /**
90
106
  * Read a conversation's recent messages, or one thread — so an agent can
@@ -1 +1 @@
1
- {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/tools/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAClH,OAAO,EACL,KAAK,mBAAmB,EAIzB,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,sBAAsB,iBAAiB,CAAC;AAErD;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,mBAAmB,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,CAAC;CACpD,KAAK,OAAO,CAAC;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,mBAAmB,KAAK,MAAM,GAAG,SAAS,CAAC;AAE/G;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,GAChC,MAAM,iBAAiB,EACvB,UAAS;IAAE,aAAa,CAAC,EAAE,qBAAqB,CAAA;CAAO,KACtD,IAmED,CAAC;AAEH,eAAO,MAAM,sBAAsB,iBAAiB,CAAC;AAErD,yDAAyD;AACzD,eAAO,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6 +93,14 @@ const MESSAGE_READ_DEFAULT_LIMIT = 50;
93
93
  * agent pages on with `before`/`after`.
94
94
  */
95
95
  export const MESSAGE_READ_TEXT_BUDGET = 40_000;
96
+ /**
97
+ * The share of `MESSAGE_READ_TEXT_BUDGET` a channel's bookmarks may take,
98
+ * counted first. It holds Slack's limit of 100 at a typical length; what
99
+ * it exists to stop is the people in a channel filling the agent's context
100
+ * with bookmarks. The ones that do not fit are counted, not paged: Slack
101
+ * lists them all in one call.
102
+ */
103
+ export const MESSAGE_READ_BOOKMARK_BUDGET = 16_000;
96
104
  const TRUNCATED_MARK = ' [... the rest of this message is not shown]';
97
105
  const optionalId = (input, key, tool = MESSAGE_READ_TOOL_NAME) => {
98
106
  const value = input[key];
@@ -105,18 +113,20 @@ const optionalId = (input, key, tool = MESSAGE_READ_TOOL_NAME) => {
105
113
  return value.trim();
106
114
  };
107
115
  /** The refusal a direct-message read gets, before any approval prompt. */
108
- export const directMessageReadRefusal = (destination) => `message.read cannot read ${destination}: it is a direct message, and direct messages are never read from outside them. `
116
+ export const directMessageReadRefusal = (destination) => `message.read cannot read ${destination}: it is a direct message this conversation is not in, and a direct message is read only from inside it. `
109
117
  + 'This is not a permission, so approval cannot unlock it; do not ask for one or try again. '
110
118
  + 'Read a channel instead, or ask the person to paste what you need.';
111
119
  export const createMessageReadTool = (read, options = {}) => ({
112
120
  name: MESSAGE_READ_TOOL_NAME,
113
121
  description: 'Read recent messages in a channel your app is a member of, or one thread in it. '
114
- + 'Direct messages and group DMs cannot be read with this, and approval does not change that. '
122
+ + 'Direct messages and group DMs cannot be read with this, except the one this conversation is in, and approval does not change that. '
115
123
  + 'Without thread: the top level, newest first. With thread: that thread\'s root and replies, oldest first. '
116
124
  + 'For Slack, ids are channel ids and message ts values; a permalink '
117
125
  + '…/archives/C0123456789/p1791332967606559 is channel C0123456789 and message 1791332967.606559, '
118
126
  + 'and a thread_ts in the link is the thread to read. '
119
- + 'When more is true, page on with before (top level) or after (thread) set to the last id returned.',
127
+ + 'When more is true, page on with before (top level) or after (thread) set to the last id returned. '
128
+ + 'A top-level read without before or after also returns the channel\'s bookmarks, when it has any; '
129
+ + 'if bookmarksOmitted is set, say that many were left out rather than guess them.',
120
130
  risk: 'gated',
121
131
  outputTrust: 'external',
122
132
  parameters: {
@@ -158,14 +168,35 @@ export const createMessageReadTool = (read, options = {}) => ({
158
168
  : MESSAGE_READ_DEFAULT_LIMIT;
159
169
  const result = await read({
160
170
  agentId: session.agent.id,
171
+ sessionId: session.id,
161
172
  source,
162
173
  limit,
163
174
  ...(thread !== undefined ? { thread } : {}),
164
175
  ...(after !== undefined ? { after } : {}),
165
176
  ...(before !== undefined ? { before } : {}),
166
177
  });
167
- const messages = [];
178
+ // Bookmarks first, from their own share, in the channel's order.
179
+ const bookmarks = [];
168
180
  let used = 0;
181
+ for (const bookmark of result.bookmarks ?? []) {
182
+ // Counted as the list is serialized: each entry with its separator,
183
+ // plus the closing bracket.
184
+ const size = JSON.stringify(bookmark).length + 1;
185
+ if (used + size + 1 > MESSAGE_READ_BOOKMARK_BUDGET) {
186
+ break;
187
+ }
188
+ bookmarks.push({ title: bookmark.title, link: bookmark.link });
189
+ used += size;
190
+ }
191
+ if (bookmarks.length > 0) {
192
+ used += 1;
193
+ }
194
+ // Added to what the adapter itself already left out, if it said.
195
+ const upstreamOmitted = typeof result.bookmarksOmitted === 'number' && Number.isInteger(result.bookmarksOmitted) && result.bookmarksOmitted > 0
196
+ ? result.bookmarksOmitted
197
+ : 0;
198
+ const bookmarksOmitted = upstreamOmitted + (result.bookmarks?.length ?? 0) - bookmarks.length;
199
+ const messages = [];
169
200
  let more = result.more;
170
201
  for (const message of result.messages) {
171
202
  const size = JSON.stringify(message).length;
@@ -177,13 +208,36 @@ export const createMessageReadTool = (read, options = {}) => ({
177
208
  // One message bigger than the whole budget is cut rather than
178
209
  // dropped, or the read could never get past it. Its file list goes
179
210
  // too, said by count, since a list can be as long as any text.
211
+ // One that would fit on its own, crowded out only by the bookmarks
212
+ // ahead of it, loses about what they took rather than half.
180
213
  if (messages.length === 0) {
181
214
  const { files, ...rest } = message;
182
- const cut = {
215
+ const cutTo = (keep) => ({
183
216
  ...rest,
184
- text: message.text.slice(0, MESSAGE_READ_TEXT_BUDGET / 2) + TRUNCATED_MARK,
217
+ text: message.text.slice(0, Math.max(0, keep)) + TRUNCATED_MARK,
185
218
  ...(files && files.length > 0 ? { files: [`${files.length} files, not listed`] } : {}),
186
- };
219
+ });
220
+ let cut = cutTo(MESSAGE_READ_TEXT_BUDGET / 2);
221
+ if (used > 0 && size <= MESSAGE_READ_TEXT_BUDGET) {
222
+ // The longest cut that fits, measured as serialized, since
223
+ // escapes make the text longer and may sit anywhere in it.
224
+ const room = MESSAGE_READ_TEXT_BUDGET - used;
225
+ const fits = (keep) => JSON.stringify(cutTo(keep)).length <= room;
226
+ if (fits(0)) {
227
+ let low = 0;
228
+ let high = message.text.length;
229
+ while (low < high) {
230
+ const middle = Math.ceil((low + high) / 2);
231
+ if (fits(middle)) {
232
+ low = middle;
233
+ }
234
+ else {
235
+ high = middle - 1;
236
+ }
237
+ }
238
+ cut = cutTo(low);
239
+ }
240
+ }
187
241
  messages.push(cut);
188
242
  }
189
243
  more = true;
@@ -194,6 +248,9 @@ export const createMessageReadTool = (read, options = {}) => ({
194
248
  ...(thread !== undefined ? { thread } : {}),
195
249
  count: messages.length,
196
250
  more,
251
+ ...(bookmarks.length > 0 ? { bookmarks } : {}),
252
+ ...(bookmarksOmitted > 0 ? { bookmarksOmitted } : {}),
253
+ ...(result.bookmarksUnavailable !== undefined ? { bookmarksUnavailable: result.bookmarksUnavailable } : {}),
197
254
  messages,
198
255
  };
199
256
  },
@@ -1 +1 @@
1
- {"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/tools/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA6D,MAAM,oBAAoB,CAAC;AAClH,OAAO,EAEL,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,G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GAAG,MAAM,GAAG,CAAC,CAAC;4BACpB,CAAC;wBACH,CAAC;wBACD,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;oBACnB,CAAC;gBACH,CAAC;gBACD,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACrB,CAAC;YACD,IAAI,GAAG,IAAI,CAAC;YACZ,MAAM;QACR,CAAC;QACD,OAAO;YACL,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC;YACpC,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3C,KAAK,EAAE,QAAQ,CAAC,MAAM;YACtB,IAAI;YACJ,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9C,GAAG,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACrD,GAAG,CAAC,MAAM,CAAC,oBAAoB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,oBAAoB,EAAE,MAAM,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3G,QAAQ;SACK,CAAC;IAClB,CAAC;CACF,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stratusagent/agents",
3
- "version": "0.13.5",
3
+ "version": "0.13.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "node": ">=22.13 <23 || >=23.4"
19
19
  },
20
20
  "dependencies": {
21
- "@stratusagent/core": "0.13.5"
21
+ "@stratusagent/core": "0.13.7"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^24.6.0",
@@ -24,6 +24,7 @@ Everything is under `~/.stratus/` on the daemon's machine:
24
24
  | --- | --- |
25
25
  | `config.json` | The global config, and the trusted one (see "Config"). `0600`, because a plugin's config in it can hold secrets such as `tool-shell`'s `env`, and every save keeps it that way; `stratus doctor` flags one other users can read |
26
26
  | `credentials.json` | Provider sign-ins (shared, and any agent's own under `agentSignIns.<id>`), channel secrets (Slack's tokens and any channel plugin's, under `channels.<kind>.<agentId>`), and named credentials. `0600`, and kept that way by Stratus, which is why it is edited with `stratus credential set` and `stratus channel set` rather than by hand |
27
+ | `credential-audit.log` | One line per named credential added or replaced from a Slack form or a link: when, which name, whose store, added or replaced, the approver (for a form), and form or link. Names only, never a value. `0600` |
27
28
  | `agents/<file>.md` | A soul: one agent's identity and allowlists. The file name is not the id; the id is the soul's `id:`, or derived from its `name:`. Use the id your instructions give |
28
29
  | `agents/<id>/` | That agent's state: `sessions.db`, `memory.jsonl`, `whitelist.json` (its standing approvals), and `workspace/` |
29
30
  | `agents/<id>/workspace/` | The agent's own working directory, where `shell.run` starts by default |
@@ -66,22 +67,27 @@ When a setting "isn't taking", these say why:
66
67
 
67
68
  ## Credentials and API keys
68
69
 
69
- This is the question you will be asked most. A secret reaches Stratus in one of four ways, and which one depends on what uses it:
70
+ This is the question you will be asked most. A secret reaches Stratus in one of these ways, and which one depends on what uses it:
70
71
 
71
72
  - **Provider sign-ins** (the model's own key or subscription): `stratus setup` → Providers, or the dashboard. There is no `stratus login`.
72
73
  - **One agent on its own Claude subscription**: `stratus signin set anthropic --agent <id>` at the machine, with a token from `claude setup-token` typed at the hidden prompt or piped on stdin. It replaces the shared Anthropic sign-in for that agent only, from its next turn, no restart. `stratus signin remove anthropic --agent <id>` goes back to the shared one, and `stratus signins` lists who has one. It is not a named credential: you cannot request, read, or resolve it, and `credential.request` is the wrong tool for it. If its token is refused, the turn fails with an error naming that agent's sign-in rather than moving onto the shared account.
73
74
  - **Channel tokens** (a Slack app's tokens): `stratus setup` → Channels, or the dashboard. No agent can read them, yours included.
74
- - **Named credentials**, such as `search.apiKey`, are for tools whose plugin declares that name. A web search backend is the common one: its key is always `search.apiKey`, whatever the vendor. These are the only secrets you can ask for yourself.
75
- - **A shell command's or an MCP server's token** is not a named credential: `shell.run` and MCP servers never read the credential store. Your operator puts it in the trusted config at the machine, and the daemon needs a restart:
76
- - for the shell, in `@stratusagent/tool-shell`'s `env`, under `agents.<id>` to keep it to one agent (whose commands can then read it). An agent's `env` is added to the shared one rather than replacing it, its own names win, and a name set to `null` there is withheld from that agent;
77
- - for an MCP server, in `servers.<name>.headers` (HTTP) or `servers.<name>.env` (stdio), which every agent granted `mcp.<name>.*` uses. Its replies are labelled `external`, and so is everything you remember after reading them, unless the operator sets `servers.<name>.outputTrust` to `agent` (or `unknown`) for a server they run; never `user`.
75
+ - **Named credentials**, such as `search.apiKey` or `github.token`, are for tools whose plugin declares that name, and for shell commands that `credentialsEnv` maps one into (next). A web search backend is the common one: its key is always `search.apiKey`, whatever the vendor. These are the only secrets you can ask for yourself.
76
+ - **A shell command's token** reaches `shell.run` as an environment variable. Your operator sets that up in the trusted config at the machine, and a change there needs a daemon restart:
77
+ - from the credential store, with `@stratusagent/tool-shell`'s `credentialsEnv`: `{ "GH_TOKEN": "github.token" }` gives each of your commands your stored `github.token` in `GH_TOKEN`, so a CLI that reads its token from a variable just works. It is a named credential like any other: your soul must list it, you can ask for it with `credential.request`, and a replaced value reaches the next command with no restart. Fleet-wide, or under `agents.<id>` for one agent;
78
+ - or as a value written into tool-shell's `env`, under `agents.<id>` to keep it to one agent. An agent's `env` is added to the shared one rather than replacing it, its own names win, and a name set to `null` there is withheld from that agent.
78
79
 
79
- `passEnv` beside them forwards variables, values included, from the daemon's own environment, and only ones that are not secret belong on it.
80
+ Either way your commands can read the value (`echo $GH_TOKEN` prints it), so only narrowly scoped tokens belong there.
81
+ - **An MCP server's token** is not a named credential: MCP servers never read the credential store. Your operator puts it in `servers.<name>.headers` (HTTP) or `servers.<name>.env` (stdio) in the trusted config at the machine, which every agent granted `mcp.<name>.*` uses, and the daemon needs a restart. Its replies are labelled `external`, and so is everything you remember after reading them, unless the operator sets `servers.<name>.outputTrust` to `agent` (or `unknown`) for a server they run; never `user`.
80
82
 
81
- For a named credential to reach you, three things must all be true. It is **stored**, your soul's `credentials:` **lists its name**, and a tool you have **declares it**. Storing grants nothing by itself. You never see the value, and there is no file or variable for you to look in. Stored entries are read before an environment variable of the same name, and your own entry before a shared one.
83
+ `passEnv` beside tool-shell's or a server's `env` forwards variables, values included, from the daemon's own environment, and only ones that are not secret belong on it.
84
+
85
+ For a named credential to reach you, three things must all be true. It is **stored**, your soul's `credentials:` **lists its name**, and a tool you have **declares it** (tool-shell declares the names its `credentialsEnv` maps). Storing grants nothing by itself. Tools use the value on your behalf, and there is no file for you to look in. The one place a value shows up is a `shell.run` command's environment, in the variable `credentialsEnv` maps it to. Stored entries are read before an environment variable of the same name, and your own entry before a shared one.
82
86
 
83
87
  When you need a named credential you do not hold, first make sure a tool you have uses that name. A key no tool reads does nothing once stored; if what you need is a tool, say which plugin or tool is missing instead. Then:
84
88
 
89
+ **In Slack, the form comes first.** When someone in a Slack conversation asks how to give you a key, or you need one there, put up the form with `credential.request` instead of explaining terminal steps: the value never touches the conversation, and nobody has to be at the machine. Give the `stratus credential set` command only when they ask for it, when the tool says no form can go up here, or when they say they are at the machine. For example, asked in a Slack thread "how do I give you the GitHub token?", call `credential.request` with `name: "github.token"` and a reason, then reply: "I put a secure form in this thread. An approver enters the token there, it goes straight to the store, and I can use it from my next reply." Not a paragraph of `read -rs KEY` steps.
90
+
85
91
  1. **Ask with `credential.request`**. Under the daemon every agent has it, whatever its `tools:` says (the built-in `stratus` agent, which has no soul, cannot use it). Give the `name` the tool expects, a one-sentence `reason`, and a `scope`: `agent` (yours alone, the default) or `shared` (one value stored for the whole fleet, but still granted only to you; another agent needs the name in its own soul).
86
92
  - **A form**, in Slack, goes up in this conversation when one of `approvals.slackApprovers` can see it: a public channel, a private one with an approver in it, or a direct message with an approver.
87
93
  - **A link** comes back otherwise, or when you pass `via: "link"`, but only if your soul's `tools:` lists `credential.request` (or you have no `tools:` key); without that, it is a form or nothing. It needs the control API, and without `api.publicUrl` it opens only on the daemon's machine. Anyone who has the link can set the key, once, within 30 minutes, with no approver involved, and opening it spends nothing. So give it only to your operator. In a shared channel, or a direct message with anyone else, do not post it: ask your operator to message you directly, and ask again there. Pass `via: "form"` to get a form or nothing.
@@ -94,7 +100,7 @@ When you need a named credential you do not hold, first make sure a tool you hav
94
100
 
95
101
  (leave out `--agent` for a shared one), and to add `<name>` to `credentials:` in your soul.
96
102
 
97
- Away from the machine, named credentials are **add-only**: the control API, the Slack form, and the link can add a name nobody has stored, and refuse one already stored or supplied by the daemon's environment. Replacing or removing one is `stratus credential set` or `stratus credential remove` at the machine, because a replaced shared key moves every agent using it onto another account. `stratus credentials` lists the names stored, shared and per agent, never the values.
103
+ Away from the machine, the control API and a link only **add**: they store a name nobody has stored, and refuse one already stored or supplied by the daemon's environment. The Slack form adds too, and it is the one way to **replace** a key from chat. When one you hold is expiring or was revoked, call `credential.request` with `replace: true`. That is always a form an approver answers in this conversation, never a link. It is refused before anyone is asked when you don't hold the key, when it comes from the daemon's environment, or when your `scope` doesn't match where it is stored: a shared key needs `scope: "shared"`, because replacing it changes the key for every agent granted it. The new value is used from the next tool call or command. At the machine, `stratus credential set` replaces as well, and `stratus credential remove` is the only way to remove one. Each add or replace from a form or a link appends a line to `~/.stratus/credential-audit.log`, names only. `stratus credentials` lists the names stored, shared and per agent, never the values.
98
104
 
99
105
  A stored named credential or provider key takes effect on the next turn, with no restart. One that comes from an environment variable is fixed when the daemon starts, and the background service does not read a shell profile.
100
106
 
@@ -106,7 +112,7 @@ When a stored key "isn't found", check in this order:
106
112
 
107
113
  ## Tools, plugins, and approvals
108
114
 
109
- - **Built in everywhere:** `memory.*` (remember, recall, forget, pin) and `skill.read`, which every agent has because this skill counts. **Only under the daemon:** `schedule.*`, `message.send`, `message.read`, `agent.delegate`, and `credential.request`, so `stratus run` and `stratus chat` cannot call them.
115
+ - **Built in everywhere:** `memory.*` (remember, recall, forget, pin) and `skill.read`, which every agent has because this skill counts. **Only under the daemon:** `schedule.*`, `message.send`, `message.read`, `channel.create`, `agent.delegate`, and `credential.request`, so `stratus run` and `stratus chat` cannot call them.
110
116
  - **Plugins** add the rest, each installed with `npm install -g <package>` and enabled under `plugins` in the trusted config:
111
117
  - `@stratusagent/tool-fs` gives `fs.*`, inside configured roots only, so with no roots there is no filesystem. Whatever the roots, `fs.*` never reaches `~/.stratus` outside the agents' workspaces (credentials, config, logs, sessions, memories, souls, skills, grants), so a refusal there is by design, not a roots problem. Roots go in `"@stratusagent/tool-fs": { "enabled": true, "roots": ["~/notes"] }`, or under `"agents": { "<id>": { "roots": [...] } }` for one agent.
112
118
  - `@stratusagent/tool-shell` gives `shell.run`.
@@ -117,7 +123,7 @@ When a stored key "isn't found", check in this order:
117
123
  - Enabled is not granted: your soul's `tools:` must also cover a plugin's tools. `stratus plugins` walks the whole chain for each tool (installed, enabled, granted to which agents, and what approvals do with a call), so it answers "why can't you use X" in one command.
118
124
  - **Risk.** Every tool is `safe`, `gated`, or `dangerous`. The daemon runs `safe` tools unattended, among them `memory.*`, `skill.read`, `credential.request`, `agent.delegate`, `schedule.list`, `schedule.cancel`, and `fs.read`, `fs.list`, and `fs.search`. Gated tools include:
119
125
  - `web.fetch`, `fs.write`, `fs.move`, `shell.run`, `browser.*`, and `mcp.*`;
120
- - `schedule.every`, `schedule.at`, `message.send`, and `message.read` (which reads a channel your Slack app is in, never a DM, and labels what it returns `external`; a DM read is refused before any approval prompt, since approving can't make it run);
126
+ - `schedule.every`, `schedule.at`, `message.send`, `message.read` (which reads a channel your Slack app is in, or the DM you're talking in, never any other DM, and labels what it returns `external`; a top-level read also returns the channel's bookmarks, which need the `bookmarks:read` scope; a DM read is refused before any approval prompt, since approving can't make it run), and `channel.create` (which makes a channel with your own app and invites people and agents; on Slack it needs the `channels:manage` or `groups:write` scope, which apps don't have by default, and a failed invite or topic is reported while the channel stays, so don't retry the create);
121
127
  - every third-party tool, `web.search` included.
122
128
  - Under the default `approvals.posture: "open"` a gated call runs without asking; what needs approval is a dangerous call (and, under `externalContent: "gate"`, a gated one after external content). Under `"guarded"` every uncovered gated call does. What happens to a call that needs approval depends on the approvals mode. Under `headless` (the default) it is refused. Under `remote` the people in `approvals.slackApprovers` are asked in Slack (or through the control API's `/approvals`) with **Allow once**, **Always allow**, and **Deny**. Under `remote` with nobody to ask, it is refused too.
123
129
  - Either way, what was already approved still runs unattended. For `shell.run` that is a command scope, a command granted by name, plus a short built-in safe list (`cd`, `pwd`, `echo`, `true`, `false`, `whoami`, and `uname`; no `git` command, not even `git status`, since git runs programs a repository names), plus `grep`, `head`, `tail`, `wc`, `sort`, and `uniq` as filters that are never handed a path, and `cat`, `head`, `tail`, and `ls` of files inside your workspace. **Always allow** on a command like `grep` grants it by name: any arguments, as long as the line runs in your workspace and every path it names resolves inside it. A command with subcommands (`git push`, `gh pr`) keeps a command-plus-subcommand scope, and shells, interpreters, wrappers like `xargs` or `sudo`, and system commands are never granted by name. A line joined by `&&`, `||`, `;`, or `|` runs unattended when every command in it would on its own, and output may be redirected into your workspace or `/dev/null`; a background `&`, a newline, `$( )`, a heredoc, or a redirection elsewhere still means asking. For `browser.act` and `web.fetch` it is an approved site (a `web.fetch` redirect to another site is reported as `redirectedTo`, not followed), and for other gated tools a standing grant.
@@ -166,7 +172,7 @@ When a stored key "isn't found", check in this order:
166
172
  - In a container or under a system unit, `stratus serve --log-format json` also writes the log's records to stdout, for `docker logs`, journald, or a log shipper. `stratus health` is the probe.
167
173
  - **`stratus logs`** (`-f` to follow, `--agent`, `--session`) reads the structured log. It records that tools ran and sessions finished, never prompts or replies. One exception: a failed session keeps the provider's error text, so skim a log before sharing it.
168
174
  - A daemon that fails *before* it starts serving writes nothing there. Its error is in `~/.stratus/logs/stratusd.err.log` on macOS, in `journalctl --user-unit=stratusd.service` on Linux, or on the terminal that ran `stratus serve`.
169
- - **The control API** is a separate install, `@stratusagent/control-api`, serving `/api/v1` on `127.0.0.1:4123`. The web dashboard is another, `@stratusagent/dashboard`, opened with `stratus dashboard`, which starts a daemon if none is running.
175
+ - **The control API** is a separate install, `@stratusagent/control-api`, serving `/api/v1` on `127.0.0.1:4123`. The web dashboard is another, `@stratusagent/dashboard`, opened with `stratus dashboard`, which offers to install both when they are missing and starts a daemon if none is running.
170
176
  - From another device, the recommended path is a tunnel such as Tailscale, with `api.publicUrl` set to that address so credential links open there.
171
177
 
172
178
  ## When a reply stops or changes model
@@ -188,6 +194,7 @@ When a stored key "isn't found", check in this order:
188
194
  | `stratus restart` | Announced drain-and-restart of the running daemon |
189
195
  | `stratus logs` | Read the daemon's log |
190
196
  | `stratus health` | Whether the running daemon is serving: exit 0 if so, for a container healthcheck or a probe |
197
+ | `stratus sessions` (also `stratus session list`) | The running daemon's sessions, newest first: status, agent, last update, id. `--agent <id>`, `--status <status>` (`running`, `pending_approval`, `failed`, `completed`, `idle`), `--limit <n>` (default 20), `--format json` |
191
198
  | `stratus doctor` | What a run would use, and why |
192
199
  | `stratus update` | Update Stratus and its companion packages (`--check` to look first) |
193
200
  | `stratus dashboard` | Open the web dashboard with a one-time sign-in link |
@@ -221,10 +228,10 @@ Only at the machine can someone:
221
228
 
222
229
  - enable or configure a plugin (its `env` and `headers` included), or choose an executor or memory store;
223
230
  - install or update packages;
224
- - replace or remove a named credential;
231
+ - remove a named credential, or replace one without an approver's form;
225
232
  - raise a memory's trust (`stratus memory reassert`).
226
233
 
227
- When you need one of those, ask for it precisely, once: the exact command, the file and the line to change, and what it will let you do. For example: "Run `stratus credential set search.apiKey --agent kai` with the key on stdin, and add `search.apiKey` under `credentials:` in my soul. Once a search plugin is enabled, `web.search` is in my `tools:`, and approvals let it run, I can search." Not a list of possibilities, and not a guess presented as a step.
234
+ When you need one of those, ask for it precisely, once: the exact command, the file and the line to change, and what it will let you do. For example: "In `~/.stratus/config.json`, add `"credentialsEnv": { "GH_TOKEN": "github.token" }` under `agents.kai` in the `@stratusagent/tool-shell` block, then run `stratus restart`. After that, `gh` in my shell uses the `github.token` I already hold." Not a list of possibilities, and not a guess presented as a step.
228
235
 
229
236
  ## Going further
230
237