@stratusagent/agents 0.13.7 → 0.14.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.
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Which environment variables a stored credential may be put in for a shell
3
+ * command, decided once for every surface that sets or asks for one: tool-shell
4
+ * when it runs the command, the gateway when an agent asks for a key with
5
+ * `env`, the CLI when an operator binds one, and the credential link page.
6
+ * Two copies of this list drifted is the reason it lives here: a name the
7
+ * request-time check let through and the command-time check refused would
8
+ * be a form an approver answered for nothing.
9
+ */
10
+ /**
11
+ * Environment variables that carry options for a command the permission
12
+ * engine judges by its arguments. tool-shell never passes them to a child.
13
+ */
14
+ export declare const COMMAND_OPTION_VARIABLES: readonly ["RIPGREP_CONFIG_PATH", "GREP_OPTIONS", "GZIP"];
15
+ /**
16
+ * Variables that make git use a repository other than the one the command
17
+ * runs in, which the permission engine finds from the working directory.
18
+ * Identity and config (`GIT_CONFIG_GLOBAL`, author names) are untouched.
19
+ */
20
+ export declare const GIT_REPOSITORY_VARIABLES: readonly string[];
21
+ /**
22
+ * Variables that make a shell run code before the command, or read it
23
+ * differently from the permission engine. `CDPATH` sends a relative `cd`
24
+ * somewhere other than the working directory the engine follows it from.
25
+ * `BASHOPTS`, `SHELLOPTS` and `POSIXLY_CORRECT` switch on shell options at
26
+ * startup (`cdable_vars` makes `cd HOME` follow `$HOME`).
27
+ */
28
+ export declare const SHELL_STARTUP_VARIABLES: readonly string[];
29
+ /**
30
+ * Why `variable` cannot carry a credential into a shell command, or
31
+ * undefined when it can. A sentence for whoever chose it.
32
+ *
33
+ * `requested: true` is the rule for a name an agent asked for
34
+ * (`credential.request`'s `env`), which must also look like a secret's.
35
+ * Without it, the operator's rule: only the refused list applies, the same
36
+ * one tool-shell's `credentialsEnv` has always kept.
37
+ */
38
+ export declare const credentialVariableProblem: (variable: string, options?: {
39
+ requested?: boolean;
40
+ }) => string | undefined;
41
+ //# sourceMappingURL=credential-env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-env.d.ts","sourceRoot":"","sources":["../src/credential-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AAKH,eAAO,MAAM,wBAAwB,0DAA2D,CAAC;AAEjG;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAErD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAEpD,CAAC;AAiBF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GAAI,UAAU,MAAM,EAAE,UAAS;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,KAAG,MAAM,GAAG,SAkB5G,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Which environment variables a stored credential may be put in for a shell
3
+ * command, decided once for every surface that sets or asks for one: tool-shell
4
+ * when it runs the command, the gateway when an agent asks for a key with
5
+ * `env`, the CLI when an operator binds one, and the credential link page.
6
+ * Two copies of this list drifted is the reason it lives here: a name the
7
+ * request-time check let through and the command-time check refused would
8
+ * be a form an approver answered for nothing.
9
+ */
10
+ /**
11
+ * Environment variables that carry options for a command the permission
12
+ * engine judges by its arguments. tool-shell never passes them to a child.
13
+ */
14
+ // Not POSIXLY_CORRECT here: macOS's /bin/sh exports it to every command it
15
+ // runs, so the permission engine reads arguments both ways instead (see
16
+ // `operandsToo` in @stratusagent/permissions). It is a shell startup variable
17
+ // below, which keeps it out of a credential.
18
+ export const COMMAND_OPTION_VARIABLES = ['RIPGREP_CONFIG_PATH', 'GREP_OPTIONS', 'GZIP'];
19
+ /**
20
+ * Variables that make git use a repository other than the one the command
21
+ * runs in, which the permission engine finds from the working directory.
22
+ * Identity and config (`GIT_CONFIG_GLOBAL`, author names) are untouched.
23
+ */
24
+ export const GIT_REPOSITORY_VARIABLES = [
25
+ 'GIT_DIR', 'GIT_WORK_TREE', 'GIT_COMMON_DIR', 'GIT_INDEX_FILE', 'GIT_OBJECT_DIRECTORY', 'GIT_ALTERNATE_OBJECT_DIRECTORIES', 'GIT_NAMESPACE',
26
+ ];
27
+ /**
28
+ * Variables that make a shell run code before the command, or read it
29
+ * differently from the permission engine. `CDPATH` sends a relative `cd`
30
+ * somewhere other than the working directory the engine follows it from.
31
+ * `BASHOPTS`, `SHELLOPTS` and `POSIXLY_CORRECT` switch on shell options at
32
+ * startup (`cdable_vars` makes `cd HOME` follow `$HOME`).
33
+ */
34
+ export const SHELL_STARTUP_VARIABLES = [
35
+ 'BASH_ENV', 'ENV', 'ZDOTDIR', 'CDPATH', 'BASHOPTS', 'SHELLOPTS', 'POSIXLY_CORRECT',
36
+ ];
37
+ /** Variables a credential must not replace: what finds programs and where they keep their files. */
38
+ const RESERVED_CREDENTIAL_VARIABLES = ['PATH', 'HOME', 'SHELL', 'USER', 'LOGNAME', 'TMPDIR', 'PWD', 'IFS'];
39
+ const VARIABLE_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
40
+ /**
41
+ * What a variable an agent names must look like: a secret's. The model picks
42
+ * the name, and a variable can change what an allowed command does
43
+ * (`GIT_SSH_COMMAND`, `NODE_OPTIONS`, `LD_PRELOAD`), which would get around
44
+ * the permission engine's judgment of the command text. Every name a CLI
45
+ * reads a token from that we know of has one of these endings. Anything
46
+ * else (`DATABASE_URL`) is an operator's call, made on the machine.
47
+ */
48
+ const REQUESTED_VARIABLE_NAME = /^[A-Z][A-Z0-9_]*_(TOKEN|KEY|SECRET|PASSWORD|SID|ID)$/;
49
+ /**
50
+ * Why `variable` cannot carry a credential into a shell command, or
51
+ * undefined when it can. A sentence for whoever chose it.
52
+ *
53
+ * `requested: true` is the rule for a name an agent asked for
54
+ * (`credential.request`'s `env`), which must also look like a secret's.
55
+ * Without it, the operator's rule: only the refused list applies, the same
56
+ * one tool-shell's `credentialsEnv` has always kept.
57
+ */
58
+ export const credentialVariableProblem = (variable, options = {}) => {
59
+ if (!VARIABLE_NAME.test(variable)) {
60
+ return `${JSON.stringify(variable)} is not an environment variable name. Use letters, digits and underscores, not starting with a digit.`;
61
+ }
62
+ if (RESERVED_CREDENTIAL_VARIABLES.includes(variable)
63
+ || COMMAND_OPTION_VARIABLES.includes(variable)
64
+ || SHELL_STARTUP_VARIABLES.includes(variable)
65
+ || GIT_REPOSITORY_VARIABLES.includes(variable)
66
+ || variable.startsWith('BASH_FUNC_')) {
67
+ return `A credential can't be put in ${variable}, because it changes how commands are found or run. `
68
+ + 'Use the variable a CLI reads its token from, such as GH_TOKEN.';
69
+ }
70
+ if (options.requested === true && !REQUESTED_VARIABLE_NAME.test(variable)) {
71
+ return `${variable} doesn't look like a secret's variable. An agent may only ask for one in uppercase ending in `
72
+ + '_TOKEN, _KEY, _SECRET, _PASSWORD, _SID or _ID (GH_TOKEN, TWILIO_AUTH_TOKEN). '
73
+ + 'Any other name is your operator\'s to bind on the machine with `stratus credential env`.';
74
+ }
75
+ return undefined;
76
+ };
77
+ //# sourceMappingURL=credential-env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-env.js","sourceRoot":"","sources":["../src/credential-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,2EAA2E;AAC3E,wEAAwE;AACxE,8EAA8E;AAC9E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,qBAAqB,EAAE,cAAc,EAAE,MAAM,CAAU,CAAC;AAEjG;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAsB;IACzD,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,kCAAkC,EAAE,eAAe;CAC5I,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAsB;IACxD,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB;CACnF,CAAC;AAEF,oGAAoG;AACpG,MAAM,6BAA6B,GAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAE9H,MAAM,aAAa,GAAG,0BAA0B,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,uBAAuB,GAAG,sDAAsD,CAAC;AAEvF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,QAAgB,EAAE,UAAmC,EAAE,EAAsB,EAAE;IACvH,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAClC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,uGAAuG,CAAC;IAC5I,CAAC;IACD,IAAI,6BAA6B,CAAC,QAAQ,CAAC,QAAQ,CAAC;WAC9C,wBAA8C,CAAC,QAAQ,CAAC,QAAQ,CAAC;WAClE,uBAAuB,CAAC,QAAQ,CAAC,QAAQ,CAAC;WAC1C,wBAAwB,CAAC,QAAQ,CAAC,QAAQ,CAAC;WAC3C,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACvC,OAAO,gCAAgC,QAAQ,sDAAsD;cACjG,gEAAgE,CAAC;IACvE,CAAC;IACD,IAAI,OAAO,CAAC,SAAS,KAAK,IAAI,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1E,OAAO,GAAG,QAAQ,+FAA+F;cAC7G,+EAA+E;cAC/E,0FAA0F,CAAC;IACjG,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
@@ -0,0 +1,66 @@
1
+ import type { JsonValue } from '@stratusagent/core';
2
+ /**
3
+ * An event as a trigger sees it: CloudEvents 1.0 context attributes plus its
4
+ * data. Attributes are strings, by their CloudEvents names (`id`, `source`,
5
+ * `specversion`, `type`, and optionally `subject`, `time`, and extensions
6
+ * such as the GitHub mapping's `actor` and `author`). Every value here came
7
+ * from outside: a valid signature proves who delivered it, not who wrote it.
8
+ */
9
+ export interface InboundEvent {
10
+ attributes: Readonly<Record<string, string>>;
11
+ data?: JsonValue;
12
+ }
13
+ /**
14
+ * A filter expression, in the six dialects every CloudEvents Subscriptions
15
+ * implementation must support (Subscriptions API 0.1, 3.2.4.1.1). Matching is
16
+ * case-sensitive. No code, no regex, no model: it runs on every delivery,
17
+ * before anything else can spend money.
18
+ *
19
+ * One Stratus extension: a key starting `data.` is a dotted path into the
20
+ * event's JSON data, and matches only a string there. The Codex use case
21
+ * needs it, because a Codex result and its in-progress summary differ only in
22
+ * the first line of the comment body.
23
+ */
24
+ export type EventFilter = {
25
+ exact: Record<string, string>;
26
+ } | {
27
+ prefix: Record<string, string>;
28
+ } | {
29
+ suffix: Record<string, string>;
30
+ } | {
31
+ all: EventFilter[];
32
+ } | {
33
+ any: EventFilter[];
34
+ } | {
35
+ not: EventFilter;
36
+ };
37
+ /**
38
+ * A daily window in which a trigger's firings are held, not sent: `from` and
39
+ * `to` are `HH:MM` on a 24-hour clock in `timeZone` (IANA). A window whose
40
+ * `to` is earlier than its `from` runs across midnight.
41
+ */
42
+ export interface QuietHours {
43
+ from: string;
44
+ to: string;
45
+ timeZone: string;
46
+ }
47
+ /** A trigger fires at most this many turns an hour unless it says otherwise. */
48
+ export declare const DEFAULT_EVENT_MAX_PER_HOUR = 12;
49
+ /**
50
+ * Validate a filter and return a canonical copy that shares nothing with the
51
+ * input. Throws a sentence naming the problem: an unknown dialect is refused
52
+ * at creation, as the Subscriptions spec requires, never ignored at match
53
+ * time where nobody would hear about it.
54
+ */
55
+ export declare const parseEventFilter: (raw: unknown) => EventFilter;
56
+ /**
57
+ * Whether `event` passes `filter`. An attribute the event lacks matches no
58
+ * comparison, so `not` of that comparison is true, as the dialects define.
59
+ * Expects a filter that went through `parseEventFilter`.
60
+ */
61
+ export declare const matchesEventFilter: (filter: EventFilter, event: InboundEvent) => boolean;
62
+ /** Validate quiet hours, throwing a sentence that names the problem. */
63
+ export declare const parseQuietHours: (raw: unknown) => QuietHours;
64
+ /** Whether `now` falls inside the window, in the window's own time zone. */
65
+ export declare const isWithinQuietHours: (quietHours: QuietHours, now: Date) => boolean;
66
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AASpD;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GACjC;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAClC;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAClC;IAAE,GAAG,EAAE,WAAW,EAAE,CAAA;CAAE,GACtB;IAAE,GAAG,EAAE,WAAW,EAAE,CAAA;CAAE,GACtB;IAAE,GAAG,EAAE,WAAW,CAAA;CAAE,CAAC;AAEzB;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,gFAAgF;AAChF,eAAO,MAAM,0BAA0B,KAAK,CAAC;AA+C7C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,OAAO,KAAG,WA8C/C,CAAC;AA8BF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,WAAW,EAAE,OAAO,YAAY,KAAG,OAiB7E,CAAC;AASF,wEAAwE;AACxE,eAAO,MAAM,eAAe,GAAI,KAAK,OAAO,KAAG,UAsB9C,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,GAAI,YAAY,UAAU,EAAE,KAAK,IAAI,KAAG,OAatE,CAAC"}
package/dist/events.js ADDED
@@ -0,0 +1,180 @@
1
+ /** A trigger fires at most this many turns an hour unless it says otherwise. */
2
+ export const DEFAULT_EVENT_MAX_PER_HOUR = 12;
3
+ const DIALECTS = ['exact', 'prefix', 'suffix', 'all', 'any', 'not'];
4
+ /**
5
+ * Bounds on a filter's shape. A person approves a trigger by reading its
6
+ * filter, and the listener evaluates every filter on every delivery; both
7
+ * stop working on a filter nobody can read.
8
+ */
9
+ const MAX_FILTER_DEPTH = 8;
10
+ const MAX_FILTER_NODES = 64;
11
+ // CloudEvents attribute names are lowercase ASCII letters and digits. The
12
+ // `data.` extension's segments are any non-empty JSON key without a dot.
13
+ const ATTRIBUTE_NAME = /^[a-z0-9]+$/;
14
+ const DATA_PATH = /^data(\.[^.]+)+$/;
15
+ const isPlainObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
16
+ const parseComparison = (dialect, raw) => {
17
+ if (!isPlainObject(raw)) {
18
+ throw new Error(`A "${dialect}" filter takes an object of attribute names to strings, e.g. { "${dialect}": { "type": "com.github.push" } }.`);
19
+ }
20
+ const entries = Object.entries(raw);
21
+ if (entries.length === 0) {
22
+ throw new Error(`A "${dialect}" filter needs at least one attribute to compare.`);
23
+ }
24
+ const out = {};
25
+ for (const [name, value] of entries) {
26
+ if (!ATTRIBUTE_NAME.test(name) && !DATA_PATH.test(name)) {
27
+ throw new Error(`"${name}" is not an attribute name a filter can use. Use a CloudEvents attribute (lowercase letters and digits, e.g. type, subject, actor) or a data path like data.review.body.`);
28
+ }
29
+ if (typeof value !== 'string') {
30
+ throw new Error(`The "${dialect}" value for "${name}" must be a string.`);
31
+ }
32
+ if (value.length === 0) {
33
+ throw new Error(`The "${dialect}" value for "${name}" is empty; the CloudEvents filter dialects do not allow empty values.`);
34
+ }
35
+ out[name] = value;
36
+ }
37
+ return out;
38
+ };
39
+ /**
40
+ * Validate a filter and return a canonical copy that shares nothing with the
41
+ * input. Throws a sentence naming the problem: an unknown dialect is refused
42
+ * at creation, as the Subscriptions spec requires, never ignored at match
43
+ * time where nobody would hear about it.
44
+ */
45
+ export const parseEventFilter = (raw) => {
46
+ let nodes = 0;
47
+ const parse = (value, depth) => {
48
+ if (depth > MAX_FILTER_DEPTH) {
49
+ throw new Error(`This filter is nested more than ${MAX_FILTER_DEPTH} levels deep; flatten it with "all" or "any".`);
50
+ }
51
+ nodes += 1;
52
+ if (nodes > MAX_FILTER_NODES) {
53
+ throw new Error(`This filter is too large (over ${MAX_FILTER_NODES} expressions); a person approving it has to be able to read it.`);
54
+ }
55
+ if (!isPlainObject(value)) {
56
+ throw new Error('A filter is an object with one dialect key: exact, prefix, suffix, all, any or not.');
57
+ }
58
+ const keys = Object.keys(value);
59
+ if (keys.length !== 1) {
60
+ throw new Error(`A filter expression has exactly one dialect key; this one has ${keys.length}${keys.length > 0 ? ` (${keys.join(', ')})` : ''}.`);
61
+ }
62
+ const dialect = keys[0];
63
+ const body = value[dialect];
64
+ switch (dialect) {
65
+ case 'exact':
66
+ case 'prefix':
67
+ case 'suffix':
68
+ return { [dialect]: parseComparison(dialect, body) };
69
+ case 'all':
70
+ case 'any': {
71
+ if (!Array.isArray(body)) {
72
+ throw new Error(`An "${dialect}" filter takes an array of filter expressions.`);
73
+ }
74
+ if (body.length === 0) {
75
+ throw new Error(`An "${dialect}" filter needs at least one filter expression.`);
76
+ }
77
+ const children = body.map((child) => parse(child, depth + 1));
78
+ return dialect === 'all' ? { all: children } : { any: children };
79
+ }
80
+ case 'not': {
81
+ if (!isPlainObject(body)) {
82
+ throw new Error('A "not" filter takes one filter expression (an object), not an array.');
83
+ }
84
+ return { not: parse(body, depth + 1) };
85
+ }
86
+ default:
87
+ throw new Error(`"${dialect}" is not a supported filter dialect. Use one of ${DIALECTS.join(', ')}.`);
88
+ }
89
+ };
90
+ return parse(raw, 1);
91
+ };
92
+ /** The string at a `data.` path, or undefined when the path leads anywhere else. */
93
+ const dataString = (data, path) => {
94
+ let cursor = data;
95
+ for (const segment of path.split('.').slice(1)) {
96
+ // Own keys of plain objects only: a path through an array index or the
97
+ // prototype (`constructor.name`) is not something the sender wrote.
98
+ if (!isPlainObject(cursor) || !Object.hasOwn(cursor, segment)) {
99
+ return undefined;
100
+ }
101
+ cursor = cursor[segment];
102
+ }
103
+ return typeof cursor === 'string' ? cursor : undefined;
104
+ };
105
+ const valueOf = (event, name) => name.startsWith('data.')
106
+ ? dataString(event.data, name)
107
+ : Object.hasOwn(event.attributes, name) ? event.attributes[name] : undefined;
108
+ const compare = (event, pairs, test) => Object.entries(pairs).every(([name, expected]) => {
109
+ const actual = valueOf(event, name);
110
+ return actual !== undefined && test(actual, expected);
111
+ });
112
+ /**
113
+ * Whether `event` passes `filter`. An attribute the event lacks matches no
114
+ * comparison, so `not` of that comparison is true, as the dialects define.
115
+ * Expects a filter that went through `parseEventFilter`.
116
+ */
117
+ export const matchesEventFilter = (filter, event) => {
118
+ if ('exact' in filter) {
119
+ return compare(event, filter.exact, (actual, expected) => actual === expected);
120
+ }
121
+ if ('prefix' in filter) {
122
+ return compare(event, filter.prefix, (actual, expected) => actual.startsWith(expected));
123
+ }
124
+ if ('suffix' in filter) {
125
+ return compare(event, filter.suffix, (actual, expected) => actual.endsWith(expected));
126
+ }
127
+ if ('all' in filter) {
128
+ return filter.all.every((child) => matchesEventFilter(child, event));
129
+ }
130
+ if ('any' in filter) {
131
+ return filter.any.some((child) => matchesEventFilter(child, event));
132
+ }
133
+ return !matchesEventFilter(filter.not, event);
134
+ };
135
+ const CLOCK_TIME = /^([01]\d|2[0-3]):([0-5]\d)$/;
136
+ const minutesOf = (text) => {
137
+ const match = CLOCK_TIME.exec(text);
138
+ return Number(match[1]) * 60 + Number(match[2]);
139
+ };
140
+ /** Validate quiet hours, throwing a sentence that names the problem. */
141
+ export const parseQuietHours = (raw) => {
142
+ if (!isPlainObject(raw)) {
143
+ throw new Error('quietHours is an object: { "from": "22:00", "to": "07:00", "timeZone": "America/New_York" }.');
144
+ }
145
+ const { from, to, timeZone } = raw;
146
+ for (const [name, value] of [['from', from], ['to', to]]) {
147
+ if (typeof value !== 'string' || !CLOCK_TIME.test(value)) {
148
+ throw new Error(`quietHours.${name} must be a 24-hour time written HH:MM, like "22:00".`);
149
+ }
150
+ }
151
+ if (from === to) {
152
+ throw new Error('quietHours.from and quietHours.to are the same time, which leaves no window.');
153
+ }
154
+ if (typeof timeZone !== 'string' || timeZone.trim().length === 0) {
155
+ throw new Error('quietHours.timeZone is required: an IANA time zone like "America/New_York" or "UTC".');
156
+ }
157
+ try {
158
+ new Intl.DateTimeFormat('en-US', { timeZone });
159
+ }
160
+ catch {
161
+ throw new Error(`"${timeZone}" is not a time zone this host knows. Use an IANA name like "America/New_York" or "UTC".`);
162
+ }
163
+ return { from: from, to: to, timeZone };
164
+ };
165
+ /** Whether `now` falls inside the window, in the window's own time zone. */
166
+ export const isWithinQuietHours = (quietHours, now) => {
167
+ const parts = new Intl.DateTimeFormat('en-US', {
168
+ timeZone: quietHours.timeZone,
169
+ hour: '2-digit',
170
+ minute: '2-digit',
171
+ hourCycle: 'h23',
172
+ }).formatToParts(now);
173
+ const hour = Number(parts.find((part) => part.type === 'hour')?.value);
174
+ const minute = Number(parts.find((part) => part.type === 'minute')?.value);
175
+ const at = hour * 60 + minute;
176
+ const from = minutesOf(quietHours.from);
177
+ const to = minutesOf(quietHours.to);
178
+ return from < to ? at >= from && at < to : at >= from || at < to;
179
+ };
180
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAmDA,gFAAgF;AAChF,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,C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GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,IAAI,EAAE,GAAG,EAAE,CAAC;AACnE,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3,13 +3,15 @@ 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
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
+ export { type InboundEvent, type EventFilter, type QuietHours, DEFAULT_EVENT_MAX_PER_HOUR, parseEventFilter, matchesEventFilter, parseQuietHours, isWithinQuietHours, } from './events.ts';
6
7
  export { type AgentRouteRule, type AgentRouter, createAgentRouter, createAgentTeam, } from './router.ts';
7
8
  export { MEMORY_TOOL_NAME, createRememberTool, RECALL_TOOL_NAME, createRecallTool, FORGET_TOOL_NAME, createForgetTool, PIN_TOOL_NAME, createPinTool, type MemoryToolOptions, } from './tools/memory.ts';
8
9
  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
- export { SCHEDULE_EVERY_TOOL_NAME, SCHEDULE_AT_TOOL_NAME, SCHEDULE_LIST_TOOL_NAME, SCHEDULE_CANCEL_TOOL_NAME, createScheduleTools, } from './tools/schedule.ts';
10
+ export { SCHEDULE_EVERY_TOOL_NAME, SCHEDULE_AT_TOOL_NAME, SCHEDULE_ON_TOOL_NAME, SCHEDULE_LIST_TOOL_NAME, SCHEDULE_CANCEL_TOOL_NAME, createScheduleTools, } from './tools/schedule.ts';
10
11
  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
12
  export { CHANNEL_CREATE_TOOL_NAME, type ConversationCreator, createChannelCreateTool, } from './tools/channel.ts';
12
13
  export { CREDENTIAL_REQUEST_TOOL_NAME, type CredentialRequester, createCredentialRequestTool, } from './tools/credentials.ts';
14
+ export { COMMAND_OPTION_VARIABLES, GIT_REPOSITORY_VARIABLES, SHELL_STARTUP_VARIABLES, credentialVariableProblem, } from './credential-env.ts';
13
15
  export { GATEWAY_ONLY_TOOL_NAMES } from './tools/gateway-only.ts';
14
16
  export { loadStratusSkill, STRATUS_SKILL_PATH } from './builtin-skills.ts';
15
17
  //# sourceMappingURL=index.d.ts.map
@@ -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,MAA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B,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,EACL,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -8,13 +8,15 @@ 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
10
  export { canonicalDestination, sameConversation, parseInterval, parseCronExpression, nextFireAfter, describeCadence, SCHEDULE_ID_METADATA_KEY, SCHEDULED_TURN_METADATA_KEY, describeSchedule, } from "./schedules.js";
11
+ export { DEFAULT_EVENT_MAX_PER_HOUR, parseEventFilter, matchesEventFilter, parseQuietHours, isWithinQuietHours, } from "./events.js";
11
12
  export { createAgentRouter, createAgentTeam, } from "./router.js";
12
13
  export { MEMORY_TOOL_NAME, createRememberTool, RECALL_TOOL_NAME, createRecallTool, FORGET_TOOL_NAME, createForgetTool, PIN_TOOL_NAME, createPinTool, } from "./tools/memory.js";
13
14
  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
- export { SCHEDULE_EVERY_TOOL_NAME, SCHEDULE_AT_TOOL_NAME, SCHEDULE_LIST_TOOL_NAME, SCHEDULE_CANCEL_TOOL_NAME, createScheduleTools, } from "./tools/schedule.js";
15
+ export { SCHEDULE_EVERY_TOOL_NAME, SCHEDULE_AT_TOOL_NAME, SCHEDULE_ON_TOOL_NAME, SCHEDULE_LIST_TOOL_NAME, SCHEDULE_CANCEL_TOOL_NAME, createScheduleTools, } from "./tools/schedule.js";
15
16
  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
17
  export { CHANNEL_CREATE_TOOL_NAME, createChannelCreateTool, } from "./tools/channel.js";
17
18
  export { CREDENTIAL_REQUEST_TOOL_NAME, createCredentialRequestTool, } from "./tools/credentials.js";
19
+ export { COMMAND_OPTION_VARIABLES, GIT_REPOSITORY_VARIABLES, SHELL_STARTUP_VARIABLES, credentialVariableProblem, } from "./credential-env.js";
18
20
  export { GATEWAY_ONLY_TOOL_NAMES } from "./tools/gateway-only.js";
19
21
  export { loadStratusSkill, STRATUS_SKILL_PATH } from "./builtin-skills.js";
20
22
  //# sourceMappingURL=index.js.map
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,E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GACxB,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"}
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,EAIL,0BAA0B,EAC1B,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,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,4BAA4B,EAC5B,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,iBAAiB,EAGjB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,sBAAsB,EAEtB,qBAAqB,EAErB,sBAAsB,EACtB,sBAAsB,EACtB,4BAA4B,EAC5B,wBAAwB,EAGxB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,wBAAwB,EAExB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,4BAA4B,EAE5B,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { JsonObject, TrustLevel } from '@stratusagent/core';
2
+ import type { EventFilter, QuietHours } from './events.ts';
2
3
  /**
3
4
  * Where a schedule reports, or a `message.send` speaks: a channel kind plus
4
5
  * a channel-native id — the same convention approver lists use, because
@@ -26,10 +27,12 @@ export interface ScheduleDestination {
26
27
  */
27
28
  export declare const canonicalDestination: (destination: ScheduleDestination) => string;
28
29
  /**
29
- * When a schedule runs. Three shapes rather than one string, because the
30
- * three are advanced differently: an interval adds itself to the previous
31
- * slot, a cron expression is searched forward, and a one-shot has no next
32
- * at all.
30
+ * When a schedule runs. Separate shapes rather than one string, because each
31
+ * is advanced differently: an interval adds itself to the previous slot, a
32
+ * cron expression is searched forward, a one-shot has no next at all, and an
33
+ * event trigger (card 590) has no slots: it fires when a delivery from its
34
+ * operator-configured `source` passes its `filter`, so the due scan never
35
+ * sees it.
33
36
  */
34
37
  export type ScheduleCadence = {
35
38
  kind: 'every';
@@ -40,6 +43,13 @@ export type ScheduleCadence = {
40
43
  } | {
41
44
  kind: 'at';
42
45
  at: string;
46
+ } | {
47
+ kind: 'event';
48
+ source: string;
49
+ filter: EventFilter;
50
+ quietHours?: QuietHours;
51
+ /** Turns per hour at most; `DEFAULT_EVENT_MAX_PER_HOUR` when absent. */
52
+ maxPerHour?: number;
43
53
  };
44
54
  /** One durable schedule, exactly as the human approved it. */
45
55
  export interface ScheduleRecord {
@@ -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;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;CA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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,UAqBxD,CAAC"}
package/dist/schedules.js CHANGED
@@ -143,6 +143,9 @@ export const nextFireAfter = (cadence, after) => {
143
143
  }
144
144
  return at.getTime() > after.getTime() ? at : undefined;
145
145
  }
146
+ case 'event':
147
+ // Fired by deliveries, never by the clock.
148
+ return undefined;
146
149
  default:
147
150
  return undefined;
148
151
  }
@@ -163,6 +166,8 @@ export const describeCadence = (cadence) => {
163
166
  return `cron ${cadence.expression}`;
164
167
  case 'at':
165
168
  return `once at ${cadence.at}`;
169
+ case 'event':
170
+ return `on ${cadence.source} events`;
166
171
  default:
167
172
  return 'unknown';
168
173
  }
@@ -236,6 +241,16 @@ export const describeSchedule = (record) => ({
236
241
  trust: record.trust ?? 'unknown',
237
242
  ...(record.destination ? { destination: canonicalDestination(record.destination) } : {}),
238
243
  ...(record.destination?.thread ? { thread: record.destination.thread } : {}),
244
+ ...(record.cadence.kind === 'event'
245
+ ? {
246
+ event: {
247
+ source: record.cadence.source,
248
+ filter: record.cadence.filter,
249
+ ...(record.cadence.quietHours ? { quietHours: { ...record.cadence.quietHours } } : {}),
250
+ ...(record.cadence.maxPerHour !== undefined ? { maxPerHour: record.cadence.maxPerHour } : {}),
251
+ },
252
+ }
253
+ : {}),
239
254
  ...(record.nextFireAt ? { nextFireAt: record.nextFireAt } : {}),
240
255
  ...(record.lastFiredAt ? { lastFiredAt: record.lastFiredAt } : {}),
241
256
  createdAt: record.createdAt,
@@ -1 +1 @@
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,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,CAA0B,CAAC,CAAC;IACrG,OAAO,MAAM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MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/D,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAClE,SAAS,EAAE,MAAM,CAAC,SAAS;CAC5B,CAAC,CAAC"}
@@ -16,6 +16,7 @@ export type CredentialRequester = (request: {
16
16
  reason?: string;
17
17
  via?: CredentialDelivery;
18
18
  replace?: boolean;
19
+ env?: string;
19
20
  }, session: Session) => Promise<{
20
21
  requestId: string;
21
22
  via: 'form';
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/tools/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAc,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAEzG,eAAO,MAAM,4BAA4B,uBAAuB,CAAC;AAEjE;;;;;;;;;GASG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,eAAe,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,EAC/G,OAAO,EAAE,OAAO,KACb,OAAO,CACR;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,CACpH,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,2BAA2B,GAAI,mBAAmB,mBAAmB,KAAG,IA4EnF,CAAC"}
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/tools/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAc,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAEzG,eAAO,MAAM,4BAA4B,uBAAuB,CAAC;AAEjE;;;;;;;;;GASG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,eAAe,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,EAC7H,OAAO,EAAE,OAAO,KACb,OAAO,CACR;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,CACpH,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,2BAA2B,GAAI,mBAAmB,mBAAmB,KAAG,IAwFnF,CAAC"}
@@ -16,7 +16,8 @@ export const CREDENTIAL_REQUEST_TOOL_NAME = 'credential.request';
16
16
  export const createCredentialRequestTool = (requestCredential) => ({
17
17
  name: CREDENTIAL_REQUEST_TOOL_NAME,
18
18
  description: 'Ask your operator for a named credential you do not hold (for example github.token). They are shown a form to add it, in this conversation where it can show one, or behind a one-time link you are given to pass on; you never see the value, and once they add it the tools that need it can use it from your next reply. Scope "agent" (the default) keeps it yours alone; "shared" stores it once for the fleet, but it is granted only to you: another agent can use it only once its own soul lists the name. '
19
- + 'To rotate a key you already hold (expiring, revoked), set replace: true: an approver gets a form in this conversation to enter the new value, which swaps the stored one in place. A replace is never a link, and a shared key needs scope "shared" to say so, since it changes the key for every agent that uses it.',
19
+ + 'To rotate a key you already hold (expiring, revoked), set replace: true: an approver gets a form in this conversation to enter the new value, which swaps the stored one in place. A replace is never a link, and a shared key needs scope "shared" to say so, since it changes the key for every agent that uses it. '
20
+ + 'For a key a command or script you run with shell.run reads from an environment variable, set env to that variable (GH_TOKEN, TWILIO_AUTH_TOKEN): the form tells the person your shell will be able to read it, and once they add it your commands have it from your next reply, with no config change or restart.',
20
21
  risk: 'safe',
21
22
  parameters: {
22
23
  type: 'object',
@@ -28,6 +29,10 @@ export const createCredentialRequestTool = (requestCredential) => ({
28
29
  type: 'boolean',
29
30
  description: 'true to ask for a new value for a key you already hold, replacing the stored one. Form only.',
30
31
  },
32
+ env: {
33
+ type: 'string',
34
+ description: 'The environment variable your shell commands should read the key from, for a CLI or script that reads its token from one: GH_TOKEN, TWILIO_AUTH_TOKEN. Uppercase, ending in _TOKEN, _KEY, _SECRET, _PASSWORD, _SID or _ID. Omit it for a key only a tool uses.',
35
+ },
31
36
  via: {
32
37
  type: 'string',
33
38
  enum: ['form', 'link'],
@@ -57,24 +62,31 @@ export const createCredentialRequestTool = (requestCredential) => ({
57
62
  throw new Error('A replacement is asked for in a form an approver answers, never a link: a link lets whoever holds it change a key every call you make uses. Ask without via, in a conversation that can show a form.');
58
63
  }
59
64
  const reason = typeof input.reason === 'string' && input.reason.trim().length > 0 ? input.reason.trim() : undefined;
65
+ if (input.env !== undefined && (typeof input.env !== 'string' || input.env.trim().length === 0)) {
66
+ throw new Error('credential.request "env" is the environment variable your shell commands read the key from, like GH_TOKEN; omit it for a key only a tool uses.');
67
+ }
68
+ const env = typeof input.env === 'string' ? input.env.trim() : undefined;
60
69
  const asked = await requestCredential({
61
70
  name,
62
71
  scope,
63
72
  ...(reason !== undefined ? { reason } : {}),
64
73
  ...(via !== undefined ? { via } : {}),
65
74
  ...(replace ? { replace } : {}),
75
+ ...(env !== undefined ? { env } : {}),
66
76
  }, session);
67
- const after = replace
77
+ const after = (replace
68
78
  ? 'You will not see the value; once an approver enters it, it replaces the stored one and your tools use it from your next reply.'
69
- : 'You will not see the value; once they add it, the tools that need it can use it from your next reply.';
79
+ : 'You will not see the value; once they add it, the tools that need it can use it from your next reply.')
80
+ + (env !== undefined ? ` Your shell commands will read it as $${env} from then on.` : '');
70
81
  if (asked.via === 'form') {
71
- return { requested: true, requestId: asked.requestId, name, scope, via: 'form', ...(replace ? { replace } : {}), note: `Your operator was asked in this conversation. ${after}` };
82
+ return { requested: true, requestId: asked.requestId, name, scope, via: 'form', ...(replace ? { replace } : {}), ...(env !== undefined ? { env } : {}), note: `Your operator was asked in this conversation. ${after}` };
72
83
  }
73
84
  return {
74
85
  requested: true,
75
86
  requestId: asked.requestId,
76
87
  name,
77
88
  scope,
89
+ ...(env !== undefined ? { env } : {}),
78
90
  via: 'link',
79
91
  link: asked.url,
80
92
  expiresAt: asked.expiresAt,
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/tools/credentials.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AAoBjE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,iBAAsC,EAAQ,EAAE,CAAC,CAAC;IAC5F,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,sfAAsf;UAC/f,uTAAuT;IAC3T,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2FAA2F,EAAE;YAClI,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,E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,EAAE,CAAC;kBACL,KAAK;SACV,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -1 +1 @@
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
+ {"version":3,"file":"gateway-only.d.ts","sourceRoot":"","sources":["../../src/tools/gateway-only.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAWpD,CAAC"}
@@ -2,7 +2,7 @@ import { CHANNEL_CREATE_TOOL_NAME } from "./channel.js";
2
2
  import { CREDENTIAL_REQUEST_TOOL_NAME } from "./credentials.js";
3
3
  import { DELEGATE_TOOL_NAME } from "./delegate.js";
4
4
  import { MESSAGE_READ_TOOL_NAME, MESSAGE_SEND_TOOL_NAME } from "./message.js";
5
- import { SCHEDULE_EVERY_TOOL_NAME, SCHEDULE_AT_TOOL_NAME, SCHEDULE_LIST_TOOL_NAME, SCHEDULE_CANCEL_TOOL_NAME, } from "./schedule.js";
5
+ import { SCHEDULE_EVERY_TOOL_NAME, SCHEDULE_AT_TOOL_NAME, SCHEDULE_ON_TOOL_NAME, SCHEDULE_LIST_TOOL_NAME, SCHEDULE_CANCEL_TOOL_NAME, } from "./schedule.js";
6
6
  /**
7
7
  * The tools only a running gateway registers. Each needs the dispatcher,
8
8
  * the store, or the channels, and nothing else in the tree has them — so a
@@ -23,6 +23,7 @@ import { SCHEDULE_EVERY_TOOL_NAME, SCHEDULE_AT_TOOL_NAME, SCHEDULE_LIST_TOOL_NAM
23
23
  export const GATEWAY_ONLY_TOOL_NAMES = [
24
24
  SCHEDULE_EVERY_TOOL_NAME,
25
25
  SCHEDULE_AT_TOOL_NAME,
26
+ SCHEDULE_ON_TOOL_NAME,
26
27
  SCHEDULE_LIST_TOOL_NAME,
27
28
  SCHEDULE_CANCEL_TOOL_NAME,
28
29
  MESSAGE_SEND_TOOL_NAME,
@@ -1 +1 @@
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"}
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,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAsB;IACxD,wBAAwB;IACxB,qBAAqB;IACrB,qBAAqB;IACrB,uBAAuB;IACvB,yBAAyB;IACzB,sBAAsB;IACtB,sBAAsB;IACtB,wBAAwB;IACxB,kBAAkB;IAClB,4BAA4B;CAC7B,CAAC"}
@@ -2,14 +2,16 @@ import { type Tool } from '@stratusagent/core';
2
2
  import { type SchedulerHandle } from '../schedules.ts';
3
3
  export declare const SCHEDULE_EVERY_TOOL_NAME = "schedule.every";
4
4
  export declare const SCHEDULE_AT_TOOL_NAME = "schedule.at";
5
+ export declare const SCHEDULE_ON_TOOL_NAME = "schedule.on";
5
6
  export declare const SCHEDULE_LIST_TOOL_NAME = "schedule.list";
6
7
  export declare const SCHEDULE_CANCEL_TOOL_NAME = "schedule.cancel";
7
8
  /**
8
- * The four `schedule.*` tools over one handle.
9
+ * The five `schedule.*` tools over one handle.
9
10
  *
10
11
  * Risk is split per tool, not per toolset: creating a schedule spends
11
12
  * future money unattended and (with a destination) mints a standing
12
- * permission to speak, so `schedule.every` and `schedule.at` are `gated` —
13
+ * permission to speak, so `schedule.every`, `schedule.at` and `schedule.on`
14
+ * are `gated` —
13
15
  * the approval of THAT call is the human decision the whole step leans on.
14
16
  * `schedule.list` is a read, and `schedule.cancel` only ever narrows
15
17
  * authority — it is the reversal the risk note in the spec names — so both
@@ -1 +1 @@
1
- {"version":3,"file":"schedule.d.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"}
1
+ {"version":3,"file":"schedule.d.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;AAuBzB,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AAEzD,eAAO,MAAM,qBAAqB,gBAAgB,CAAC;AAEnD,eAAO,MAAM,qBAAqB,gBAAgB,CAAC;AAKnD,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;AAEvD,eAAO,MAAM,yBAAyB,oBAAoB,CAAC;AAE3D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,GAAI,WAAW,eAAe,KAAG,IAAI,EAuMpE,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { conversationContextFrom, isTaintedTrust, leastTrusted, sessionWriteTrust, } from '@stratusagent/core';
2
2
  import { parseInterval, parseCronExpression, parseScheduleDestinationInput, SCHEDULE_DESTINATION_PARAMETER, describeSchedule, sameConversation, } from "../schedules.js";
3
+ import { DEFAULT_EVENT_MAX_PER_HOUR, parseEventFilter, parseQuietHours } from "../events.js";
3
4
  const TOP_LEVEL_PARAMETER = {
4
5
  type: 'boolean',
5
6
  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.',
@@ -20,14 +21,18 @@ const originThreadFor = (session, destination) => {
20
21
  };
21
22
  export const SCHEDULE_EVERY_TOOL_NAME = 'schedule.every';
22
23
  export const SCHEDULE_AT_TOOL_NAME = 'schedule.at';
24
+ export const SCHEDULE_ON_TOOL_NAME = 'schedule.on';
25
+ /** The most turns an hour an event trigger may ask for: one every 30 seconds. */
26
+ const MAX_EVENT_TRIGGER_PER_HOUR = 120;
23
27
  export const SCHEDULE_LIST_TOOL_NAME = 'schedule.list';
24
28
  export const SCHEDULE_CANCEL_TOOL_NAME = 'schedule.cancel';
25
29
  /**
26
- * The four `schedule.*` tools over one handle.
30
+ * The five `schedule.*` tools over one handle.
27
31
  *
28
32
  * Risk is split per tool, not per toolset: creating a schedule spends
29
33
  * future money unattended and (with a destination) mints a standing
30
- * permission to speak, so `schedule.every` and `schedule.at` are `gated` —
34
+ * permission to speak, so `schedule.every`, `schedule.at` and `schedule.on`
35
+ * are `gated` —
31
36
  * the approval of THAT call is the human decision the whole step leans on.
32
37
  * `schedule.list` is a read, and `schedule.cancel` only ever narrows
33
38
  * authority — it is the reversal the risk note in the spec names — so both
@@ -124,6 +129,61 @@ export const createScheduleTools = (scheduler) => {
124
129
  return create(session, { kind: 'at', at: parsed.toISOString() }, input);
125
130
  },
126
131
  },
132
+ {
133
+ name: SCHEDULE_ON_TOOL_NAME,
134
+ description: 'Set an event trigger for yourself: when a delivery from an operator-configured event source (like "github") passes your filter, run your prompt with the event appended. '
135
+ + 'The filter uses the CloudEvents dialects exact, prefix, suffix, all, any and not over attributes such as type, subject, actor and author; a key like "data.review.body" matches a string inside the event\'s data. '
136
+ + 'The event text is from outside, so the turn runs labeled external. Needs human approval once; firings then run unattended.',
137
+ risk: 'gated',
138
+ parameters: {
139
+ type: 'object',
140
+ properties: {
141
+ source: { type: 'string', description: 'The event source id the operator configured, e.g. "github".' },
142
+ filter: {
143
+ type: 'object',
144
+ description: 'One filter expression with exactly one dialect key, e.g. { "all": [ { "exact": { "actor": "chatgpt-codex-connector[bot]" } }, { "prefix": { "type": "com.github.pull_request_review" } } ] }.',
145
+ },
146
+ prompt: { type: 'string', description: 'The instruction each firing runs, phrased to stand alone. The event follows it.' },
147
+ quietHours: {
148
+ type: 'object',
149
+ description: 'Optional daily window in which firings are held and then sent together, e.g. { "from": "22:00", "to": "07:00", "timeZone": "America/New_York" }.',
150
+ properties: {
151
+ from: { type: 'string', description: 'Start, HH:MM on a 24-hour clock.' },
152
+ to: { type: 'string', description: 'End, HH:MM on a 24-hour clock.' },
153
+ timeZone: { type: 'string', description: 'IANA time zone, e.g. "America/New_York".' },
154
+ },
155
+ required: ['from', 'to', 'timeZone'],
156
+ },
157
+ maxPerHour: { type: 'number', description: `Most turns an hour this trigger may start (default ${DEFAULT_EVENT_MAX_PER_HOUR}, at most ${MAX_EVENT_TRIGGER_PER_HOUR}).` },
158
+ destination: SCHEDULE_DESTINATION_PARAMETER,
159
+ topLevel: TOP_LEVEL_PARAMETER,
160
+ },
161
+ required: ['source', 'filter', 'prompt'],
162
+ },
163
+ async execute(input, session) {
164
+ const source = typeof input.source === 'string' ? input.source.trim() : '';
165
+ if (!source) {
166
+ throw new Error('schedule.on needs a "source": the id of an event source the operator configured, like "github".');
167
+ }
168
+ if (input.filter === undefined) {
169
+ throw new Error('schedule.on needs a "filter": one expression such as { "exact": { "type": "com.github.pull_request_review.submitted" } }.');
170
+ }
171
+ const filter = parseEventFilter(input.filter);
172
+ const quietHours = input.quietHours !== undefined ? parseQuietHours(input.quietHours) : undefined;
173
+ const maxPerHour = input.maxPerHour;
174
+ if (maxPerHour !== undefined
175
+ && (typeof maxPerHour !== 'number' || !Number.isInteger(maxPerHour) || maxPerHour < 1 || maxPerHour > MAX_EVENT_TRIGGER_PER_HOUR)) {
176
+ throw new Error(`"maxPerHour" must be a whole number from 1 to ${MAX_EVENT_TRIGGER_PER_HOUR}.`);
177
+ }
178
+ return create(session, {
179
+ kind: 'event',
180
+ source,
181
+ filter,
182
+ ...(quietHours !== undefined ? { quietHours } : {}),
183
+ ...(maxPerHour !== undefined ? { maxPerHour: maxPerHour } : {}),
184
+ }, input);
185
+ },
186
+ },
127
187
  {
128
188
  name: SCHEDULE_LIST_TOOL_NAME,
129
189
  description: 'List your own schedules: cadence, prompt, destination, and when each fires next.',
@@ -1 +1 @@
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,EAG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AC;YACtD,CAAC;SACF;QACD;YACE,IAAI,EAAE,yBAAyB;YAC/B,WAAW,EAAE,uHAAuH;YACpI,kEAAkE;YAClE,oEAAoE;YACpE,mEAAmE;YACnE,mEAAmE;YACnE,qBAAqB;YACrB,IAAI,EAAE,MAAM;YACZ,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;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.13.7",
3
+ "version": "0.14.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.13.7"
21
+ "@stratusagent/core": "0.14.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^24.6.0",
@@ -72,19 +72,21 @@ This is the question you will be asked most. A secret reaches Stratus in one of
72
72
  - **Provider sign-ins** (the model's own key or subscription): `stratus setup` → Providers, or the dashboard. There is no `stratus login`.
73
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.
74
74
  - **Channel tokens** (a Slack app's tokens): `stratus setup` → Channels, or the dashboard. No agent can read them, yours included.
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.
75
+ - **Named credentials**, such as `search.apiKey` or `github.token`, are for tools whose plugin declares that name, and for shell commands that read one from an environment variable (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, so a CLI or script that reads its token from one just works. It is a named credential like any other (your soul must list it), bound to the variable one of these ways:
77
+ - **Ask for it with `env`**: `credential.request` with the `name` and `env: "TWILIO_AUTH_TOKEN"`. The form tells the approver your shell will be able to read it as that variable, and answering it is their approval for that. Once they add it, your commands have `$TWILIO_AUTH_TOKEN` from your next reply, with no config edit and no restart. `env` must be uppercase and end in `_TOKEN`, `_KEY`, `_SECRET`, `_PASSWORD`, `_SID` or `_ID`; any other name is refused before anyone is asked. For a key you already hold, it is refused with the one command your operator runs instead.
78
+ - **Your operator binds it at the machine**: `stratus credential env <name> <VAR> --agent <id>`, or `stratus credential set <name> --agent <id> --env <VAR>` while storing it. Any variable except ones that change how commands run (`PATH`, `HOME`, `BASH_ENV`, `GIT_DIR` and the like), and it applies from the next command with no restart. `--remove` undoes it, and removing the key removes its bindings.
79
+ - **The trusted config**, with `@stratusagent/tool-shell`'s `credentialsEnv`: `{ "GH_TOKEN": "github.token" }`, fleet-wide or under `agents.<id>` for one agent. It is the operator's pin: a variable it maps is never taken from a binding. A config edit needs a daemon restart;
80
+ - 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. A config edit, so a restart.
79
81
 
80
82
  Either way your commands can read the value (`echo $GH_TOKEN` prints it), so only narrowly scoped tokens belong there.
81
83
  - **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`.
82
84
 
83
85
  `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
86
 
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.
87
+ 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**, or it is **bound to a variable** for your shell (tool-shell reads bindings and 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 it is bound or mapped to. Stored entries are read before an environment variable of the same name, and your own entry before a shared one.
86
88
 
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:
89
+ When you need a named credential you do not hold, first make sure a tool you have uses that name, or that a command you run reads it from an environment variable (then ask with `env`). A key nothing reads does nothing once stored; if what you need is a tool, say which plugin or tool is missing instead. Then:
88
90
 
89
91
  **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
92
 
@@ -100,7 +102,7 @@ When you need a named credential you do not hold, first make sure a tool you hav
100
102
 
101
103
  (leave out `--agent` for a shared one), and to add `<name>` to `credentials:` in your soul.
102
104
 
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.
105
+ 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, with the variable when one was bound, and so does each `stratus credential env`. `stratus credentials` lists the names stored, shared and per agent, and what each agent's shell reads, never the values.
104
106
 
105
107
  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.
106
108
 
@@ -123,7 +125,7 @@ When a stored key "isn't found", check in this order:
123
125
  - 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.
124
126
  - **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:
125
127
  - `web.fetch`, `fs.write`, `fs.move`, `shell.run`, `browser.*`, and `mcp.*`;
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);
128
+ - `schedule.every`, `schedule.at`, `schedule.on` (an event trigger: your prompt runs when a signed delivery from a source the operator configured passes your filter, labeled `external`; it is refused for a source the daemon doesn't have), `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);
127
129
  - every third-party tool, `web.search` included.
128
130
  - 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.
129
131
  - 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.
@@ -179,6 +181,7 @@ When a stored key "isn't found", check in this order:
179
181
 
180
182
  - **"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`.
181
183
  - **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.
184
+ - **Cut short by a restart.** A daemon that stops or restarts gives running turns 30 seconds, then aborts the rest. A turn started by a Slack message, an event, or an API request that sent an idempotency key is left for the next start, which continues it once, and the person is told you will answer after the restart. Any other turn is marked failed ("stratusd is stopping" or "restarting"), and the message has to be sent again. On Codex or a Claude subscription sign-in, which run their own tool loop, every such turn is marked failed, since continuing could repeat what already ran.
182
185
  - **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.
183
186
  - **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.
184
187
  - When asked why a reply stopped, look before you answer if you can: with `shell.run` you can run `stratus logs --agent <your id>` (it is gated, so it needs approval or a granted scope), and an `fs` root covering `~/.stratus/logs/` lets you read the file. Without either, give the likely cause from what your transcript shows (an out-of-steps answer, a message with no reply, a request for a very long answer) and the log command that confirms it, rather than a certain answer.
@@ -194,6 +197,7 @@ When a stored key "isn't found", check in this order:
194
197
  | `stratus restart` | Announced drain-and-restart of the running daemon |
195
198
  | `stratus logs` | Read the daemon's log |
196
199
  | `stratus health` | Whether the running daemon is serving: exit 0 if so, for a container healthcheck or a probe |
200
+ | `stratus events` | What the events port has been doing, per source: the last delivery, the last refusal and why (a webhook with the wrong secret shows here, though it leaves no row), and the last 24 hours of deliveries and firings by status. `--format json` |
197
201
  | `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` |
198
202
  | `stratus doctor` | What a run would use, and why |
199
203
  | `stratus update` | Update Stratus and its companion packages (`--check` to look first) |
@@ -204,6 +208,7 @@ When a stored key "isn't found", check in this order:
204
208
  | `stratus skills` | List skills and which agents enable each |
205
209
  | `stratus plugins` | Every tool, its plugin, who is granted it, and what approvals do |
206
210
  | `stratus credential set` / `stratus credential remove` / `stratus credentials` | Store (value on stdin) or remove a named credential; list the names |
211
+ | `stratus credential env <name> <VAR> --agent <id>` | Let that agent's shell commands read a stored key as `<VAR>`, from the next command; `--remove` undoes it |
207
212
  | `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 |
208
213
  | `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 |
209
214
  | `stratus grants <id>` / `stratus grants revoke <id>` | An agent's standing approvals, and taking one back |
@@ -227,6 +232,7 @@ Your operator can do more from anywhere they reach the dashboard or the control
227
232
  Only at the machine can someone:
228
233
 
229
234
  - enable or configure a plugin (its `env` and `headers` included), or choose an executor or memory store;
235
+ - add an event source for `schedule.on`: an `events` block in `~/.stratus/config.json` (`"sources": { "github": { "verify": "github", "secrets": ["events.github"] } }`), the secret stored with `stratus credential set events.github`, and a restart (docs/guides/events.md);
230
236
  - install or update packages;
231
237
  - remove a named credential, or replace one without an approver's form;
232
238
  - raise a memory's trust (`stratus memory reassert`).