@stratusagent/agents 0.11.9 → 0.12.0
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 +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/schedules.d.ts +35 -0
- package/dist/schedules.d.ts.map +1 -1
- package/dist/schedules.js +28 -0
- package/dist/schedules.js.map +1 -1
- package/dist/tools/message.d.ts +20 -3
- package/dist/tools/message.d.ts.map +1 -1
- package/dist/tools/message.js +41 -6
- package/dist/tools/message.js.map +1 -1
- package/dist/tools/schedule.d.ts.map +1 -1
- package/dist/tools/schedule.js +37 -6
- package/dist/tools/schedule.js.map +1 -1
- package/package.json +2 -2
- package/skills/stratus/SKILL.md +7 -5
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ export { AVATAR_STYLE, generateAgentName, generateAvatarTheme, AGENT_ID_PATTERN,
|
|
|
2
2
|
export { type DefineAgentInput, defineAgent } from './define.ts';
|
|
3
3
|
export { isDelegateAllowed, type ParsedSoul, type ParseSoulOptions, parseSoul, formatSoul, } from './soul.ts';
|
|
4
4
|
export { SKILL_ID_PATTERN, SKILL_ID_MAX_LENGTH, isValidSkillId, isLoadableSkillId, SKILL_ID_RULE, SKILL_DESCRIPTION_MAX_LENGTH, SKILL_COMPATIBILITY_MAX_LENGTH, type ParsedSkillDocument, parseSkillDocument, type ValidateSkillDocumentOptions, type SkillValidation, validateSkillDocument, type LazySkillInput, createLazySkill, } from './skills.ts';
|
|
5
|
-
export { type ScheduleDestination, canonicalDestination, type ScheduleCadence, type ScheduleRecord, parseInterval, parseCronExpression, nextFireAfter, describeCadence, SCHEDULE_ID_METADATA_KEY, SCHEDULED_TURN_METADATA_KEY, type ScheduleCreateInput, type SchedulerHandle, describeSchedule, } from './schedules.ts';
|
|
5
|
+
export { type ScheduleDestination, canonicalDestination, sameConversation, type ScheduleCadence, type ScheduleRecord, parseInterval, parseCronExpression, nextFireAfter, describeCadence, SCHEDULE_ID_METADATA_KEY, SCHEDULED_TURN_METADATA_KEY, type ScheduleCreateInput, type SchedulerHandle, describeSchedule, } from './schedules.ts';
|
|
6
6
|
export { type AgentRouteRule, type AgentRouter, createAgentRouter, createAgentTeam, } from './router.ts';
|
|
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, 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, MESSAGE_READ_TOOL_NAME, MESSAGE_READ_MAX_LIMIT, MESSAGE_READ_TEXT_BUDGET, type ConversationReader, createMessageReadTool, } 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_TEXT_BUDGET, type ConversationReader, createMessageReadTool, } from './tools/message.ts';
|
|
11
11
|
export { CREDENTIAL_REQUEST_TOOL_NAME, type CredentialRequester, createCredentialRequestTool, } from './tools/credentials.ts';
|
|
12
12
|
export { GATEWAY_ONLY_TOOL_NAMES } from './tools/gateway-only.ts';
|
|
13
13
|
export { loadStratusSkill, STRATUS_SKILL_PATH } from './builtin-skills.ts';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,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,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,KAAK,iBA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;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
|
@@ -7,7 +7,7 @@ export { AVATAR_STYLE, generateAgentName, generateAvatarTheme, AGENT_ID_PATTERN,
|
|
|
7
7
|
export { defineAgent } from "./define.js";
|
|
8
8
|
export { isDelegateAllowed, parseSoul, formatSoul, } from "./soul.js";
|
|
9
9
|
export { SKILL_ID_PATTERN, SKILL_ID_MAX_LENGTH, isValidSkillId, isLoadableSkillId, SKILL_ID_RULE, SKILL_DESCRIPTION_MAX_LENGTH, SKILL_COMPATIBILITY_MAX_LENGTH, parseSkillDocument, validateSkillDocument, createLazySkill, } from "./skills.js";
|
|
10
|
-
export { canonicalDestination, parseInterval, parseCronExpression, nextFireAfter, describeCadence, SCHEDULE_ID_METADATA_KEY, SCHEDULED_TURN_METADATA_KEY, describeSchedule, } from "./schedules.js";
|
|
10
|
+
export { canonicalDestination, sameConversation, parseInterval, parseCronExpression, nextFireAfter, describeCadence, SCHEDULE_ID_METADATA_KEY, SCHEDULED_TURN_METADATA_KEY, describeSchedule, } from "./schedules.js";
|
|
11
11
|
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, isDelegatedSession, delegatingSessionIdOf, outstandingDelegationFor, withoutDelegation, createDelegateTool, } from "./tools/delegate.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,
|
|
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,gBAAgB,CAAC;AAExB,OAAO,EAGL,iBAAiB,EACjB,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,aAAa,GAEd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,4BAA4B,EAC5B,6BAA6B,EAC7B,2BAA2B,EAC3B,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,iBAAiB,EAGjB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,sBAAsB,EAEtB,qBAAqB,EAErB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EAExB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,4BAA4B,EAE5B,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/schedules.d.ts
CHANGED
|
@@ -9,6 +9,13 @@ export interface ScheduleDestination {
|
|
|
9
9
|
channel: string;
|
|
10
10
|
/** Channel-native conversation id (Slack: `C…`/`G…`/`D…`). */
|
|
11
11
|
to: string;
|
|
12
|
+
/**
|
|
13
|
+
* For a schedule: the root of the thread in `to` its reports go under,
|
|
14
|
+
* so a schedule set from a conversation keeps reporting into it. Where,
|
|
15
|
+
* never whether: the grant stays the channel (`canonicalDestination`
|
|
16
|
+
* ignores it), and a row written before this existed reads as top-level.
|
|
17
|
+
*/
|
|
18
|
+
thread?: string;
|
|
12
19
|
}
|
|
13
20
|
/**
|
|
14
21
|
* The one string form of a destination, `<channel>:<native id>`, used
|
|
@@ -138,6 +145,15 @@ export interface SchedulerHandle {
|
|
|
138
145
|
cancel(agentId: string, scheduleId: string): Promise<boolean>;
|
|
139
146
|
}
|
|
140
147
|
export declare const parseDestinationInput: (raw: unknown) => ScheduleDestination | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* A schedule's destination: `parseDestinationInput` plus the optional
|
|
150
|
+
* `thread` its reports go under. Kept apart so `message.send` and
|
|
151
|
+
* `message.read`, which take their thread as a parameter of their own,
|
|
152
|
+
* never read one out of a destination object.
|
|
153
|
+
*/
|
|
154
|
+
export declare const parseScheduleDestinationInput: (raw: unknown) => ScheduleDestination | undefined;
|
|
155
|
+
/** Destinations are the same conversation, whatever thread either names. */
|
|
156
|
+
export declare const sameConversation: (a: ScheduleDestination, b: ScheduleDestination) => boolean;
|
|
141
157
|
export declare const DESTINATION_PARAMETER: {
|
|
142
158
|
type: string;
|
|
143
159
|
description: string;
|
|
@@ -153,6 +169,25 @@ export declare const DESTINATION_PARAMETER: {
|
|
|
153
169
|
};
|
|
154
170
|
required: string[];
|
|
155
171
|
};
|
|
172
|
+
export declare const SCHEDULE_DESTINATION_PARAMETER: {
|
|
173
|
+
description: string;
|
|
174
|
+
properties: {
|
|
175
|
+
thread: {
|
|
176
|
+
type: string;
|
|
177
|
+
description: string;
|
|
178
|
+
};
|
|
179
|
+
channel: {
|
|
180
|
+
type: string;
|
|
181
|
+
description: string;
|
|
182
|
+
};
|
|
183
|
+
to: {
|
|
184
|
+
type: string;
|
|
185
|
+
description: string;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
type: string;
|
|
189
|
+
required: string[];
|
|
190
|
+
};
|
|
156
191
|
/**
|
|
157
192
|
* One schedule as a surface shows it — the CLI table, the control API's
|
|
158
193
|
* listing, and the tool results all render this one projection, so the
|
package/dist/schedules.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedules.d.ts","sourceRoot":"","sources":["../src/schedules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AASjE;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"schedules.d.ts","sourceRoot":"","sources":["../src/schedules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AASjE;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAC;IACX;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,aAAa,mBAAmB,KAAG,MACA,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/B,8DAA8D;AAC9D,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,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B;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5D,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IACjD,sFAAsF;IACtF,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/D;AAED,eAAO,MAAM,qBAAqB,GAAI,KAAK,OAAO,KAAG,mBAAmB,GAAG,SAW1E,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,GAAI,KAAK,OAAO,KAAG,mBAAmB,GAAG,SASlF,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,GAAI,GAAG,mBAAmB,EAAE,GAAG,mBAAmB,KAAG,OAC7B,CAAC;AAEtD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;CAQZ,CAAC;AAEvB,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;CAQrB,CAAC;AAEvB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,cAAc,KAAG,UAWxD,CAAC"}
|
package/dist/schedules.js
CHANGED
|
@@ -187,6 +187,24 @@ export const parseDestinationInput = (raw) => {
|
|
|
187
187
|
}
|
|
188
188
|
return { channel: channel.trim().toLowerCase(), to: to.trim() };
|
|
189
189
|
};
|
|
190
|
+
/**
|
|
191
|
+
* A schedule's destination: `parseDestinationInput` plus the optional
|
|
192
|
+
* `thread` its reports go under. Kept apart so `message.send` and
|
|
193
|
+
* `message.read`, which take their thread as a parameter of their own,
|
|
194
|
+
* never read one out of a destination object.
|
|
195
|
+
*/
|
|
196
|
+
export const parseScheduleDestinationInput = (raw) => {
|
|
197
|
+
const destination = parseDestinationInput(raw);
|
|
198
|
+
if (!destination) {
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
201
|
+
const thread = raw.thread;
|
|
202
|
+
return typeof thread === 'string' && thread.trim().length > 0
|
|
203
|
+
? { ...destination, thread: thread.trim() }
|
|
204
|
+
: destination;
|
|
205
|
+
};
|
|
206
|
+
/** Destinations are the same conversation, whatever thread either names. */
|
|
207
|
+
export const sameConversation = (a, b) => canonicalDestination(a) === canonicalDestination(b);
|
|
190
208
|
export const DESTINATION_PARAMETER = {
|
|
191
209
|
type: 'object',
|
|
192
210
|
description: 'Where firings report. Omit for a schedule that does not speak — its sends will need approval like any other. The channel kind plus the channel-native conversation id (for Slack, a channel id like C0123456789 that your app is a member of).',
|
|
@@ -196,6 +214,15 @@ export const DESTINATION_PARAMETER = {
|
|
|
196
214
|
},
|
|
197
215
|
required: ['channel', 'to'],
|
|
198
216
|
};
|
|
217
|
+
export const SCHEDULE_DESTINATION_PARAMETER = {
|
|
218
|
+
...DESTINATION_PARAMETER,
|
|
219
|
+
description: 'Where firings report. Omit for a schedule that does not speak — its sends will need approval like any other. The channel kind plus the channel-native conversation id (for Slack, a channel id like C0123456789 that your app is a member of). '
|
|
220
|
+
+ 'Set from a thread in that same conversation, reports go into that thread by default, so replies reach you there; pass "thread" to name another, or "topLevel": true on the call to post at the top of the channel.',
|
|
221
|
+
properties: {
|
|
222
|
+
...DESTINATION_PARAMETER.properties,
|
|
223
|
+
thread: { type: 'string', description: 'Root id of a thread in that conversation to report under (for Slack, its ts).' },
|
|
224
|
+
},
|
|
225
|
+
};
|
|
199
226
|
/**
|
|
200
227
|
* One schedule as a surface shows it — the CLI table, the control API's
|
|
201
228
|
* listing, and the tool results all render this one projection, so the
|
|
@@ -208,6 +235,7 @@ export const describeSchedule = (record) => ({
|
|
|
208
235
|
prompt: record.prompt,
|
|
209
236
|
trust: record.trust ?? 'unknown',
|
|
210
237
|
...(record.destination ? { destination: canonicalDestination(record.destination) } : {}),
|
|
238
|
+
...(record.destination?.thread ? { thread: record.destination.thread } : {}),
|
|
211
239
|
...(record.nextFireAt ? { nextFireAt: record.nextFireAt } : {}),
|
|
212
240
|
...(record.lastFiredAt ? { lastFiredAt: record.lastFiredAt } : {}),
|
|
213
241
|
createdAt: record.createdAt,
|
package/dist/schedules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedules.js","sourceRoot":"","sources":["../src/schedules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schedules.js","sourceRoot":"","sources":["../src/schedules.ts"],"names":[],"mappings":"AA4BA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,WAAgC,EAAU,EAAE,CAC/E,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;AAoDzE,mFAAmF;AACnF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAY,EAAsB,EAAE;IAChE,MAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACnD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QACjD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,IAAI,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CA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,CAAC,EAAE,CAAC;IAClE,SAAS,EAAE,MAAM,CAAC,SAAS;CAC5B,CAAC,CAAC"}
|
package/dist/tools/message.d.ts
CHANGED
|
@@ -1,16 +1,31 @@
|
|
|
1
|
-
import type { Tool } from '@stratusagent/core';
|
|
1
|
+
import type { Session, Tool } from '@stratusagent/core';
|
|
2
2
|
import { type ScheduleDestination } from '../schedules.ts';
|
|
3
3
|
export declare const MESSAGE_SEND_TOOL_NAME = "message.send";
|
|
4
4
|
/**
|
|
5
5
|
* Delivers one outbound message through the agent's channel. The gateway
|
|
6
6
|
* implements it over the channel contract's `resolveOutbound`; rejecting is
|
|
7
7
|
* the way to say a destination cannot be served.
|
|
8
|
+
*
|
|
9
|
+
* Resolves with the channel-native id of the message it posted when the
|
|
10
|
+
* channel reports one (Slack: its `ts`), which is what lets an agent reply
|
|
11
|
+
* under its own post later — the id is the thread to name.
|
|
8
12
|
*/
|
|
9
13
|
export type OutboundMessenger = (input: {
|
|
10
14
|
agentId: string;
|
|
11
15
|
destination: ScheduleDestination;
|
|
12
16
|
text: string;
|
|
13
|
-
|
|
17
|
+
/** Channel-native id of the message to reply under, for a threaded post. */
|
|
18
|
+
thread?: string;
|
|
19
|
+
}) => Promise<{
|
|
20
|
+
id?: string;
|
|
21
|
+
} | void>;
|
|
22
|
+
/**
|
|
23
|
+
* The thread a send goes under when the call names none: a scheduled
|
|
24
|
+
* firing's own report thread, when it is sending to its schedule's
|
|
25
|
+
* destination. The host answers, because only it can tell a live firing
|
|
26
|
+
* from a session that merely carries a firing's metadata.
|
|
27
|
+
*/
|
|
28
|
+
export type DefaultThreadResolver = (session: Session, destination: ScheduleDestination) => string | undefined;
|
|
14
29
|
/**
|
|
15
30
|
* Post to a channel or DM outside the current conversation — what makes a
|
|
16
31
|
* scheduled turn observable.
|
|
@@ -22,7 +37,9 @@ export type OutboundMessenger = (input: {
|
|
|
22
37
|
* this call would speak, and the policy allows it exactly when the firing's
|
|
23
38
|
* schedule was approved with that destination.
|
|
24
39
|
*/
|
|
25
|
-
export declare const createMessageSendTool: (send: OutboundMessenger
|
|
40
|
+
export declare const createMessageSendTool: (send: OutboundMessenger, options?: {
|
|
41
|
+
defaultThread?: DefaultThreadResolver;
|
|
42
|
+
}) => Tool;
|
|
26
43
|
export declare const MESSAGE_READ_TOOL_NAME = "message.read";
|
|
27
44
|
/** The most messages one `message.read` call returns. */
|
|
28
45
|
export declare const MESSAGE_READ_MAX_LIMIT = 200;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/tools/message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/tools/message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACpE,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;CACjB,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,IAkED,CAAC;AAEH,eAAO,MAAM,sBAAsB,iBAAiB,CAAC;AAErD,yDAAyD;AACzD,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAG/C;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,KAAK,OAAO,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC,CAAC;IACH,IAAI,EAAE,OAAO,CAAC;CACf,CAAC,CAAC;AAaH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,kBAAkB,KAAG,IAgF/D,CAAC"}
|
package/dist/tools/message.js
CHANGED
|
@@ -11,9 +11,12 @@ export const MESSAGE_SEND_TOOL_NAME = 'message.send';
|
|
|
11
11
|
* this call would speak, and the policy allows it exactly when the firing's
|
|
12
12
|
* schedule was approved with that destination.
|
|
13
13
|
*/
|
|
14
|
-
export const createMessageSendTool = (send) => ({
|
|
14
|
+
export const createMessageSendTool = (send, options = {}) => ({
|
|
15
15
|
name: MESSAGE_SEND_TOOL_NAME,
|
|
16
|
-
description: 'Send a message to a channel or DM you are not currently talking in
|
|
16
|
+
description: 'Send a message to a channel or DM you are not currently talking in, at the top level or as a reply in one of its threads. '
|
|
17
|
+
+ 'Returns the posted message\'s id, and the thread to name to reply under it: '
|
|
18
|
+
+ 'pass that returned thread (never a reply\'s id) to every later send in the same thread. '
|
|
19
|
+
+ 'Scheduled turns may post to their schedule\'s approved destination without asking; anywhere else needs approval.',
|
|
17
20
|
risk: 'gated',
|
|
18
21
|
parameters: {
|
|
19
22
|
type: 'object',
|
|
@@ -23,6 +26,14 @@ export const createMessageSendTool = (send) => ({
|
|
|
23
26
|
description: 'Where to post: the channel kind plus the channel-native conversation id.',
|
|
24
27
|
},
|
|
25
28
|
text: { type: 'string', description: 'The message text.' },
|
|
29
|
+
thread: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'The id of a message in that conversation to reply under (for Slack, its ts, e.g. 1791332967.606559). Omit to post at the top level, or, in a scheduled run sending to its own destination, into the schedule\'s report thread.',
|
|
32
|
+
},
|
|
33
|
+
topLevel: {
|
|
34
|
+
type: 'boolean',
|
|
35
|
+
description: 'Post at the top level even in a scheduled run whose schedule reports into a thread.',
|
|
36
|
+
},
|
|
26
37
|
},
|
|
27
38
|
required: ['destination', 'text'],
|
|
28
39
|
},
|
|
@@ -39,8 +50,32 @@ export const createMessageSendTool = (send) => ({
|
|
|
39
50
|
if (!text) {
|
|
40
51
|
throw new Error('message.send requires a non-empty "text".');
|
|
41
52
|
}
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
if (input.topLevel !== undefined && typeof input.topLevel !== 'boolean') {
|
|
54
|
+
throw new Error('message.send "topLevel" must be true or false.');
|
|
55
|
+
}
|
|
56
|
+
const explicit = optionalId(input, 'thread', MESSAGE_SEND_TOOL_NAME);
|
|
57
|
+
if (explicit !== undefined && input.topLevel === true) {
|
|
58
|
+
throw new Error('message.send takes either "thread" or "topLevel": true, not both.');
|
|
59
|
+
}
|
|
60
|
+
const thread = explicit ?? (input.topLevel === true ? undefined : options.defaultThread?.(session, destination));
|
|
61
|
+
const posted = await send({
|
|
62
|
+
agentId: session.agent.id,
|
|
63
|
+
destination,
|
|
64
|
+
text,
|
|
65
|
+
...(thread !== undefined ? { thread } : {}),
|
|
66
|
+
});
|
|
67
|
+
const id = posted && typeof posted.id === 'string' && posted.id.length > 0 ? posted.id : undefined;
|
|
68
|
+
// The thread a reply to this post names: the root it went under, or,
|
|
69
|
+
// for a top-level post, the post itself. Always the root, because a
|
|
70
|
+
// reply's own id is not a thread to Slack — chaining sends through
|
|
71
|
+
// each reply's id would leave the thread after the second one.
|
|
72
|
+
const root = thread ?? id;
|
|
73
|
+
return {
|
|
74
|
+
sent: true,
|
|
75
|
+
destination: canonicalDestination(destination),
|
|
76
|
+
...(id !== undefined ? { id } : {}),
|
|
77
|
+
...(root !== undefined ? { thread: root } : {}),
|
|
78
|
+
};
|
|
44
79
|
},
|
|
45
80
|
});
|
|
46
81
|
export const MESSAGE_READ_TOOL_NAME = 'message.read';
|
|
@@ -57,13 +92,13 @@ const MESSAGE_READ_DEFAULT_LIMIT = 50;
|
|
|
57
92
|
*/
|
|
58
93
|
export const MESSAGE_READ_TEXT_BUDGET = 40_000;
|
|
59
94
|
const TRUNCATED_MARK = ' [... the rest of this message is not shown]';
|
|
60
|
-
const optionalId = (input, key) => {
|
|
95
|
+
const optionalId = (input, key, tool = MESSAGE_READ_TOOL_NAME) => {
|
|
61
96
|
const value = input[key];
|
|
62
97
|
if (value === undefined || value === null) {
|
|
63
98
|
return undefined;
|
|
64
99
|
}
|
|
65
100
|
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
66
|
-
throw new Error(
|
|
101
|
+
throw new Error(`${tool}: "${key}" must be a non-empty string when given.`);
|
|
67
102
|
}
|
|
68
103
|
return value.trim();
|
|
69
104
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/tools/message.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,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ts","sourceRoot":"","sources":["../../src/tools/schedule.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,IAAI,EACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAIL,KAAK,eAAe,EAMrB,MAAM,iBAAiB,CAAC;AAsBzB,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AAEzD,eAAO,MAAM,qBAAqB,gBAAgB,CAAC;AAEnD,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;AAEvD,eAAO,MAAM,yBAAyB,oBAAoB,CAAC;AAE3D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,GAAI,WAAW,eAAe,KAAG,IAAI,EAgJpE,CAAC"}
|
package/dist/tools/schedule.js
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
import { isTaintedTrust, leastTrusted, sessionWriteTrust, } from '@stratusagent/core';
|
|
2
|
-
import { parseInterval, parseCronExpression,
|
|
1
|
+
import { conversationContextFrom, isTaintedTrust, leastTrusted, sessionWriteTrust, } from '@stratusagent/core';
|
|
2
|
+
import { parseInterval, parseCronExpression, parseScheduleDestinationInput, SCHEDULE_DESTINATION_PARAMETER, describeSchedule, sameConversation, } from "../schedules.js";
|
|
3
|
+
const TOP_LEVEL_PARAMETER = {
|
|
4
|
+
type: 'boolean',
|
|
5
|
+
description: 'Report at the top of the destination channel even when you set this from a thread in it. Default false: a schedule set from a thread reports into that thread.',
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The thread this session's turn is in, as the channel recorded it, when
|
|
9
|
+
* that conversation is `destination`. What lets "watch this and tell me"
|
|
10
|
+
* report back where it was asked, instead of starting a new top-level
|
|
11
|
+
* post whose replies reach a session that never saw the request.
|
|
12
|
+
*/
|
|
13
|
+
const originThreadFor = (session, destination) => {
|
|
14
|
+
const channel = session.metadata?.channel;
|
|
15
|
+
const room = conversationContextFrom(session.metadata);
|
|
16
|
+
if (typeof channel !== 'string' || room?.id === undefined || room.threadRoot === undefined) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
return sameConversation({ channel, to: room.id }, destination) ? room.threadRoot : undefined;
|
|
20
|
+
};
|
|
3
21
|
export const SCHEDULE_EVERY_TOOL_NAME = 'schedule.every';
|
|
4
22
|
export const SCHEDULE_AT_TOOL_NAME = 'schedule.at';
|
|
5
23
|
export const SCHEDULE_LIST_TOOL_NAME = 'schedule.list';
|
|
@@ -22,10 +40,21 @@ export const createScheduleTools = (scheduler) => {
|
|
|
22
40
|
if (!prompt) {
|
|
23
41
|
throw new Error('A schedule needs a non-empty "prompt" — the instruction each firing runs.');
|
|
24
42
|
}
|
|
25
|
-
if (input.destination !== undefined &&
|
|
43
|
+
if (input.destination !== undefined && parseScheduleDestinationInput(input.destination) === undefined) {
|
|
26
44
|
throw new Error('"destination" must be { channel, to } with non-empty strings, or omitted.');
|
|
27
45
|
}
|
|
28
|
-
|
|
46
|
+
if (input.topLevel !== undefined && typeof input.topLevel !== 'boolean') {
|
|
47
|
+
throw new Error('"topLevel" must be true or false.');
|
|
48
|
+
}
|
|
49
|
+
const parsed = parseScheduleDestinationInput(input.destination);
|
|
50
|
+
if (parsed?.thread !== undefined && input.topLevel === true) {
|
|
51
|
+
throw new Error('Pass either a destination "thread" or "topLevel": true, not both.');
|
|
52
|
+
}
|
|
53
|
+
let destination = parsed;
|
|
54
|
+
if (parsed !== undefined && parsed.thread === undefined && input.topLevel !== true) {
|
|
55
|
+
const thread = originThreadFor(session, parsed);
|
|
56
|
+
destination = thread !== undefined ? { ...parsed, thread } : parsed;
|
|
57
|
+
}
|
|
29
58
|
const record = await scheduler.create({
|
|
30
59
|
agentId: session.agent.id,
|
|
31
60
|
cadence,
|
|
@@ -47,7 +76,8 @@ export const createScheduleTools = (scheduler) => {
|
|
|
47
76
|
every: { type: 'string', description: 'Interval like "90s", "30m", "2h", "1d". Exactly one of "every" or "cron".' },
|
|
48
77
|
cron: { type: 'string', description: 'Five-field cron expression (minute hour day-of-month month day-of-week), local time. Exactly one of "every" or "cron".' },
|
|
49
78
|
prompt: { type: 'string', description: 'The instruction each firing runs, phrased to stand alone.' },
|
|
50
|
-
destination:
|
|
79
|
+
destination: SCHEDULE_DESTINATION_PARAMETER,
|
|
80
|
+
topLevel: TOP_LEVEL_PARAMETER,
|
|
51
81
|
},
|
|
52
82
|
required: ['prompt'],
|
|
53
83
|
},
|
|
@@ -77,7 +107,8 @@ export const createScheduleTools = (scheduler) => {
|
|
|
77
107
|
properties: {
|
|
78
108
|
at: { type: 'string', description: 'When to fire, ISO-8601 (e.g. 2026-09-01T07:00:00). Must be in the future.' },
|
|
79
109
|
prompt: { type: 'string', description: 'The instruction the firing runs, phrased to stand alone.' },
|
|
80
|
-
destination:
|
|
110
|
+
destination: SCHEDULE_DESTINATION_PARAMETER,
|
|
111
|
+
topLevel: TOP_LEVEL_PARAMETER,
|
|
81
112
|
},
|
|
82
113
|
required: ['at', 'prompt'],
|
|
83
114
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../src/tools/schedule.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,YAAY,EACZ,iBAAiB,GAIlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,aAAa,EACb,mBAAmB,
|
|
1
|
+
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../src/tools/schedule.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,cAAc,EACd,YAAY,EACZ,iBAAiB,GAIlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,aAAa,EACb,mBAAmB,EAGnB,6BAA6B,EAC7B,8BAA8B,EAC9B,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,mBAAmB,GAAG;IAC1B,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,gKAAgK;CACrK,CAAC;AAEX;;;;;GAKG;AACH,MAAM,eAAe,GAAG,CAA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;oBACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6DAA6D,EAAE;iBACnG;gBACD,QAAQ,EAAE,CAAC,IAAI,CAAC;aACjB;YACD,KAAK,CAAC,OAAO,CAAC,KAAiB,EAAE,OAAgB;gBAC/C,MAAM,EAAE,GAAG,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC/D,IAAI,CAAC,EAAE,EAAE,CAAC;oBACR,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;gBAChE,CAAC;gBACD,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC/D,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,MAAM,IAAI,KAAK,CAAC,+BAA+B,EAAE,oCAAoC,CAAC,CAAC;gBACzF,CAAC;gBACD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;YACjC,CAAC;SACF;KACF,CAAC;AACJ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stratusagent/agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
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.
|
|
21
|
+
"@stratusagent/core": "0.12.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^24.6.0",
|
package/skills/stratus/SKILL.md
CHANGED
|
@@ -23,7 +23,7 @@ Everything is under `~/.stratus/` on the daemon's machine:
|
|
|
23
23
|
| Path | What it is |
|
|
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
|
-
| `credentials.json` | Provider sign-ins, 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 |
|
|
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
27
|
| `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
28
|
| `agents/<id>/` | That agent's state: `sessions.db`, `memory.jsonl`, `whitelist.json` (its standing approvals), and `workspace/` |
|
|
29
29
|
| `agents/<id>/workspace/` | The agent's own working directory, where `shell.run` starts by default |
|
|
@@ -54,7 +54,7 @@ The config decides which provider and model run, which plugins load, and how app
|
|
|
54
54
|
|
|
55
55
|
Which provider and model a turn uses: for `stratus run` and `stratus chat`, command-line flags beat `STRATUS_*` environment variables, which beat the soul's `provider`/`model`, which beat the file. Under `stratus serve` a soul's `provider`/`model` beats all of those, because each agent in a roster runs on its own. A changed `provider` or `model` in the config reaches the next turn without a restart.
|
|
56
56
|
|
|
57
|
-
A project-local `stratus.config.json` ships inside repositories, so it is **untrusted**. It cannot set `plugins`, `approvals`, `principals`, `slack`, `api`, `maxTurns`, `agentMaxTurns`, `apiKeyEnv`, `soul`, `systemPrompt`, `executor`, or `memoryStore`. Those are read only from `~/.stratus/config.json` or a file named by `--config` or `STRATUS_CONFIG`. A project-local file that sets one of them has it ignored, with a warning. For `principals`, `slack`, `maxTurns`, `executor`, and `memoryStore` the daemon uses `~/.stratus/config.json`'s instead; for `plugins`, `approvals`, and `api` it uses none. A project-local file that says nothing about one of those eight leaves the global one in force.
|
|
57
|
+
A project-local `stratus.config.json` ships inside repositories, so it is **untrusted**. It cannot set `plugins`, `approvals`, `principals`, `slack`, `api`, `maxTurns`, `agentMaxTurns`, `autoContinue`, `apiKeyEnv`, `soul`, `systemPrompt`, `executor`, or `memoryStore`. Those are read only from `~/.stratus/config.json` or a file named by `--config` or `STRATUS_CONFIG`. A project-local file that sets one of them has it ignored, with a warning. For `principals`, `slack`, `maxTurns`, `executor`, and `memoryStore` the daemon uses `~/.stratus/config.json`'s instead; for `plugins`, `approvals`, and `api` it uses none. A project-local file that says nothing about one of those eight leaves the global one in force.
|
|
58
58
|
|
|
59
59
|
When a setting "isn't taking", these say why:
|
|
60
60
|
|
|
@@ -67,6 +67,7 @@ When a setting "isn't taking", these say why:
|
|
|
67
67
|
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:
|
|
68
68
|
|
|
69
69
|
- **Provider sign-ins** (the model's own key or subscription): `stratus setup` → Providers, or the dashboard. There is no `stratus login`.
|
|
70
|
+
- **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.
|
|
70
71
|
- **Channel tokens** (a Slack app's tokens): `stratus setup` → Channels, or the dashboard. No agent can read them, yours included.
|
|
71
72
|
- **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.
|
|
72
73
|
- **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:
|
|
@@ -79,9 +80,9 @@ For a named credential to reach you, three things must all be true. It is **stor
|
|
|
79
80
|
|
|
80
81
|
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:
|
|
81
82
|
|
|
82
|
-
1. **Ask with `credential.request
|
|
83
|
+
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).
|
|
83
84
|
- **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.
|
|
84
|
-
- **A link** comes back otherwise, or when you pass `via: "link"
|
|
85
|
+
- **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.
|
|
85
86
|
- Either way the key goes straight to the store and the name into your soul, and you can use it from your next reply. A restart cancels a request still waiting.
|
|
86
87
|
2. **Otherwise, ask your operator to run, on the machine:**
|
|
87
88
|
|
|
@@ -167,7 +168,7 @@ When a stored key "isn't found", check in this order:
|
|
|
167
168
|
|
|
168
169
|
## When a reply stops or changes model
|
|
169
170
|
|
|
170
|
-
- **"Out of steps."** One message may take `maxTurns` rounds of tool calls (default 40, set in the trusted config, restart to change). Past that you are told you are out of steps, get one last call with no tools, and answer with what you did and what is left. Replying "continue" carries on with a fresh allowance. An agent that does long work should have its own budget raised with `agentMaxTurns: { "<id>": 300 }` in the trusted config (restart to change), which leaves the rest of the fleet on `maxTurns`.
|
|
171
|
+
- **"Out of steps."** One message may take `maxTurns` rounds of tool calls (default 40, set in the trusted config, restart to change). Past that you are told you are out of steps, get one last call with no tools, and answer with what you did and what is left. Replying "continue" carries on with a fresh allowance. An agent that does long work should have its own budget raised with `agentMaxTurns: { "<id>": 300 }` in the trusted config (restart to change), which leaves the rest of the fleet on `maxTurns`. With `autoContinue: { "<id>": true }` (or a number, to cap it) an agent is given another budget instead of stopping to ask, until its work is done, its cap is reached, or someone sends it another message meanwhile. Under a kernel-driven provider (Anthropic, OpenAI-compatible), it also stops when stuck on a repeating failure; the `claude-code` runtime runs its own loop and does not have that check, so an uncapped claude-code agent relies on the cap or a new message to stop. It applies to the built-in model loop and the `claude-code` runtime, not yet to `codex`.
|
|
171
172
|
- **Stopped with no reply.** On a provider that streams (Anthropic, Codex, and plugin providers that say they stream), the daemon's watchdog aborts a turn when the model reports nothing for `--idle-timeout` seconds (default 120). On one that does not, such as an OpenAI-compatible endpoint, there is no watchdog, and a silent request ends only when the provider's own request fails or times out, so `--idle-timeout` neither explains nor fixes it. The session ends failed, with `no activity for 120000ms`, and `stratus logs --agent <id>` names the last thing it heard. A tool that is running, or a call waiting on an approval, never trips it.
|
|
172
173
|
- **Cut off at the output cap.** A reply longer than the model may write in one turn fails rather than being posted half-finished, and the error says so. With an Anthropic API key that cap is `maxTokens` in the config (default 16000); a Claude subscription run does not take that setting, so raising it changes nothing there. Offer a shorter answer, or, on an API key, ask for the cap to be raised. Never ask for a longer timeout.
|
|
173
174
|
- **Answering on another model.** When the configured model fails a request and a `fallbackModel` is set, that conversation switches to the fallback and stays on it, even across restarts, so it never silently swaps back. Not every failure switches: a conversation too long for the window is trimmed and retried on the same model, a cancelled turn just stops, and a Codex or Claude subscription turn that fails after its tools already ran surfaces the error instead, since a retry elsewhere would run them twice. Those leave the conversation on the configured model, with nothing to roll over. Your instructions say when you are on the fallback. `stratus logs` shows the error that caused the switch, and `stratus session rollover <session id>` starts the conversation over on the configured model.
|
|
@@ -193,6 +194,7 @@ When a stored key "isn't found", check in this order:
|
|
|
193
194
|
| `stratus skills` | List skills and which agents enable each |
|
|
194
195
|
| `stratus plugins` | Every tool, its plugin, who is granted it, and what approvals do |
|
|
195
196
|
| `stratus credential set` / `stratus credential remove` / `stratus credentials` | Store (value on stdin) or remove a named credential; list the names |
|
|
197
|
+
| `stratus signin set anthropic --agent <id>` / `stratus signin remove` / `stratus signin list` (also `stratus signins`) | Give one agent its own Claude subscription (token at a hidden prompt or on stdin), take it back, list who has one |
|
|
196
198
|
| `stratus channel set` / `stratus channel remove` / `stratus channel list` | Store (values prompted without echo, or one per stdin line) or remove a channel's secrets for one agent; list which agents have them. A channel's secrets are never yours to read, and a running daemon picks them up at its next start |
|
|
197
199
|
| `stratus grants <id>` / `stratus grants revoke <id>` | An agent's standing approvals, and taking one back |
|
|
198
200
|
| `stratus schedules` / `stratus schedules cancel <id>` | Scheduled turns, and cancelling one |
|