@stratusagent/gateway 0.14.8 → 0.14.9
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/agent-source.d.ts +10 -0
- package/dist/agent-source.d.ts.map +1 -0
- package/dist/agent-source.js +7 -0
- package/dist/agent-source.js.map +1 -0
- package/dist/approvals.d.ts +38 -0
- package/dist/approvals.d.ts.map +1 -0
- package/dist/approvals.js +330 -0
- package/dist/approvals.js.map +1 -0
- package/dist/credential-requests.d.ts +24 -0
- package/dist/credential-requests.d.ts.map +1 -0
- package/dist/credential-requests.js +452 -0
- package/dist/credential-requests.js.map +1 -0
- package/dist/dispatch.d.ts +34 -0
- package/dist/dispatch.d.ts.map +1 -0
- package/dist/dispatch.js +461 -0
- package/dist/dispatch.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +368 -2443
- package/dist/index.js.map +1 -1
- package/dist/merge-batch.d.ts +60 -0
- package/dist/merge-batch.d.ts.map +1 -0
- package/dist/merge-batch.js +59 -0
- package/dist/merge-batch.js.map +1 -0
- package/dist/recovery.d.ts +49 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +487 -0
- package/dist/recovery.js.map +1 -0
- package/dist/steering.d.ts +24 -0
- package/dist/steering.d.ts.map +1 -0
- package/dist/steering.js +108 -0
- package/dist/steering.js.map +1 -0
- package/dist/sub-agents.d.ts +20 -0
- package/dist/sub-agents.d.ts.map +1 -0
- package/dist/sub-agents.js +263 -0
- package/dist/sub-agents.js.map +1 -0
- package/dist/turn-dispatch.d.ts +34 -0
- package/dist/turn-dispatch.d.ts.map +1 -0
- package/dist/turn-dispatch.js +179 -0
- package/dist/turn-dispatch.js.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Credential requests: the `credential.request` tool, the requests it opens,
|
|
3
|
+
* and answering one (storing the value, granting it, auditing the change).
|
|
4
|
+
* Moved out of `createGateway` in index.ts as is: the statements are
|
|
5
|
+
* unchanged, inside a factory that takes what they closed over there, and
|
|
6
|
+
* `createGateway` calls it where they were and destructures what it returns.
|
|
7
|
+
* formCredentialValue and isFlattenedPem, used only here, moved with them.
|
|
8
|
+
*/
|
|
9
|
+
import { randomUUID } from 'node:crypto';
|
|
10
|
+
import { matchesToolAllowlist, } from '@stratusagent/core';
|
|
11
|
+
import { createCredentialRequestTool, CREDENTIAL_REQUEST_TOOL_NAME, credentialVariableProblem, } from '@stratusagent/agents';
|
|
12
|
+
import { addNamedCredential, appendCredentialAudit, CREDENTIAL_NAME_PATTERN, grantSoulCredential, loadSoulFile, NamedCredentialExistsError, NamedCredentialMissingError, namedCredentialSource, quoteShellArg, replaceNamedCredential, withSoulFileLock, } from '@stratusagent/state';
|
|
13
|
+
/**
|
|
14
|
+
* A value from a form, without the line breaks around it.
|
|
15
|
+
*
|
|
16
|
+
* Forms take multi-line values now, so a one-line key copied with the line
|
|
17
|
+
* break after it would otherwise be stored with it, and fail later inside
|
|
18
|
+
* whatever header or command it lands in. Only line breaks: a value's own
|
|
19
|
+
* spaces are its own, as on the CLI.
|
|
20
|
+
*/
|
|
21
|
+
const formCredentialValue = (value) => value.replace(/^[\r\n]+|[\r\n]+$/g, '');
|
|
22
|
+
/**
|
|
23
|
+
* A PEM block (a private key, a certificate) with no line breaks left, which
|
|
24
|
+
* is what a one-line field makes of a pasted key file. PEM readers need the
|
|
25
|
+
* line after the `-----BEGIN …-----` header, so storing it would only move
|
|
26
|
+
* the failure to the first call that reads the key. Only a value that *is*
|
|
27
|
+
* one: a PEM inside JSON (a service account file) escapes its line breaks,
|
|
28
|
+
* so it has none of its own and is fine as sent.
|
|
29
|
+
*/
|
|
30
|
+
const isFlattenedPem = (value) => /^\s*-----BEGIN [A-Z0-9 ]+-----/.test(value) && !value.includes('\n');
|
|
31
|
+
export const createCredentialRequests = ({ env, warn, bus, startedChannels, channelCarrying, registry, sources, unlistedTools, tools, }) => {
|
|
32
|
+
/**
|
|
33
|
+
* Credential requests waiting on a person, by request id.
|
|
34
|
+
*
|
|
35
|
+
* In memory on purpose: a request is a question somebody is being asked
|
|
36
|
+
* now, and a restart that forgot it only means the agent asks again. What
|
|
37
|
+
* matters is that the entry carries everything the answer needs, so a
|
|
38
|
+
* channel quoting the id back decides nothing about where the key goes.
|
|
39
|
+
*/
|
|
40
|
+
const credentialRequests = new Map();
|
|
41
|
+
tools.register(createCredentialRequestTool(async (request, session) => {
|
|
42
|
+
const agentId = session.agent.id;
|
|
43
|
+
const soulPath = sources.get(agentId)?.soulPath;
|
|
44
|
+
if (soulPath === undefined) {
|
|
45
|
+
throw new Error(`${session.agent.name} is the built-in agent and has no soul file to grant a credential in. `
|
|
46
|
+
+ `Your operator can store one on the machine with \`stratus credential set ${request.name}\`.`);
|
|
47
|
+
}
|
|
48
|
+
if (!CREDENTIAL_NAME_PATTERN.test(request.name)) {
|
|
49
|
+
throw new Error(`${JSON.stringify(request.name)} is not a credential name. Use letters, digits, dots, dashes, or underscores, `
|
|
50
|
+
+ 'starting with a letter, the way the tool that needs it spells it: search.apiKey, github.token.');
|
|
51
|
+
}
|
|
52
|
+
// The stricter rule, for a name the model picked: checked before anyone
|
|
53
|
+
// is asked, so an approver never sees a form whose binding the store
|
|
54
|
+
// would refuse, and so a variable that changes what a judged command
|
|
55
|
+
// does (NODE_OPTIONS) is never offered at all.
|
|
56
|
+
if (request.env !== undefined) {
|
|
57
|
+
const problem = credentialVariableProblem(request.env, { requested: true });
|
|
58
|
+
if (problem !== undefined) {
|
|
59
|
+
throw new Error(`${problem} Nothing is pending.`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// A key already stored is not something to ask a person for again: the
|
|
63
|
+
// form only adds, so it could only fail. Say what is actually missing.
|
|
64
|
+
const source = await namedCredentialSource(env, agentId, request.name);
|
|
65
|
+
const stored = source !== undefined;
|
|
66
|
+
const granted = session.agent.credentials?.includes(request.name) === true;
|
|
67
|
+
// Binding a key the agent already holds asks for no value, and every
|
|
68
|
+
// form today has a value field, so phase 1 leaves it to the machine.
|
|
69
|
+
const bindOnMachine = request.env !== undefined
|
|
70
|
+
? ` To have your shell read it as ${request.env}, ask your operator to run \`stratus credential env ${request.name} ${request.env} --agent ${quoteShellArg(agentId)}\` on the machine.`
|
|
71
|
+
: '';
|
|
72
|
+
if (request.replace === true) {
|
|
73
|
+
// Checked here, before anyone is asked, so an approver is never shown
|
|
74
|
+
// a form whose answer could only be refused.
|
|
75
|
+
if (!stored || !granted) {
|
|
76
|
+
throw new Error(`You don't hold ${request.name}, so there is nothing to replace. Ask for it without replace.`);
|
|
77
|
+
}
|
|
78
|
+
if (source === 'environment') {
|
|
79
|
+
throw new Error(`${request.name} comes from the daemon's environment, which a form can't change. `
|
|
80
|
+
+ 'Ask your operator to change it where that environment is set.');
|
|
81
|
+
}
|
|
82
|
+
if (source === 'shared' && request.scope !== 'shared') {
|
|
83
|
+
throw new Error(`${request.name} is a shared credential, so replacing it changes the key for every agent granted it. `
|
|
84
|
+
+ 'Ask again with scope "shared" if that is what you mean.');
|
|
85
|
+
}
|
|
86
|
+
if (source === 'agent' && request.scope === 'shared') {
|
|
87
|
+
throw new Error(`${request.name} is your own credential, not a shared one. Ask again with scope "agent" to replace it.`);
|
|
88
|
+
}
|
|
89
|
+
if (request.via === 'link') {
|
|
90
|
+
throw new Error('A replacement is asked for in a form an approver answers, never a link. Nothing is pending.');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else if (stored && granted) {
|
|
94
|
+
throw new Error(`You already hold ${request.name}; the tools that need it use it for you. To rotate it for a new value, ask again with replace: true.${bindOnMachine}`
|
|
95
|
+
+ (request.env !== undefined ? ' Nothing is pending.' : ''));
|
|
96
|
+
}
|
|
97
|
+
else if (stored) {
|
|
98
|
+
throw new Error(`${request.name} is already ${source === 'environment' ? "supplied by the daemon's environment" : 'stored'} but not granted to you. `
|
|
99
|
+
+ `Ask your operator to add it to the credentials list in your soul; a form would only refuse to store it again.${bindOnMachine}`);
|
|
100
|
+
}
|
|
101
|
+
const onMachine = request.env === undefined
|
|
102
|
+
? `\`stratus credential set ${request.name}${request.scope === 'agent' ? ` --agent ${quoteShellArg(agentId)}` : ''}\``
|
|
103
|
+
: request.scope === 'agent'
|
|
104
|
+
? `\`stratus credential set ${request.name} --agent ${quoteShellArg(agentId)} --env ${request.env}\``
|
|
105
|
+
: `\`stratus credential set ${request.name}\`, then \`stratus credential env ${request.name} ${request.env} --agent ${quoteShellArg(agentId)}\``;
|
|
106
|
+
const record = {
|
|
107
|
+
agentId,
|
|
108
|
+
sessionId: session.id,
|
|
109
|
+
name: request.name,
|
|
110
|
+
scope: request.scope,
|
|
111
|
+
soulPath,
|
|
112
|
+
...(request.replace === true ? { replace: true } : {}),
|
|
113
|
+
...(request.env !== undefined ? { env: request.env } : {}),
|
|
114
|
+
};
|
|
115
|
+
const announce = async (requestId, via) => {
|
|
116
|
+
await bus.emit({
|
|
117
|
+
type: 'credential.requested',
|
|
118
|
+
sessionId: session.id,
|
|
119
|
+
agentId,
|
|
120
|
+
requestId,
|
|
121
|
+
name: request.name,
|
|
122
|
+
scope: request.scope,
|
|
123
|
+
...(request.reason !== undefined ? { reason: request.reason } : {}),
|
|
124
|
+
via,
|
|
125
|
+
...(request.replace === true ? { replace: true } : {}),
|
|
126
|
+
...(request.env !== undefined ? { env: request.env } : {}),
|
|
127
|
+
...(session.metadata ? { metadata: session.metadata } : {}),
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
// A link only for an agent whose soul lists the tool. Every agent may
|
|
131
|
+
// ask through a form, because a form goes to an approver; a link is a
|
|
132
|
+
// bearer credential the model is handed, and whoever it reaches can
|
|
133
|
+
// store a key and amend the soul. That is the operator's to allow.
|
|
134
|
+
const allowlist = session.agent.tools ?? registry.get(agentId)?.tools;
|
|
135
|
+
// An omitted list grants the safe tools, this one among them, but a
|
|
136
|
+
// link is the operator's to allow by naming it, so only a list says yes.
|
|
137
|
+
// On a home an older build set up an omitted list is every tool, and
|
|
138
|
+
// has always allowed a link there.
|
|
139
|
+
const linkAllowed = allowlist === undefined
|
|
140
|
+
? unlistedTools() === 'every'
|
|
141
|
+
: matchesToolAllowlist(CREDENTIAL_REQUEST_TOOL_NAME, allowlist);
|
|
142
|
+
// Why no form went up, said to the agent beside the link that replaces
|
|
143
|
+
// it, so it can tell the person why they are getting a link instead.
|
|
144
|
+
let formUnavailable;
|
|
145
|
+
if (request.via !== 'link') {
|
|
146
|
+
// Only a conversation a channel started has anywhere to show a form,
|
|
147
|
+
// and only a channel that renders one can show it: a scheduled or
|
|
148
|
+
// HTTP turn, or a channel with no form, would record a request nobody
|
|
149
|
+
// sees while the agent tells its user the operator was asked.
|
|
150
|
+
const kind = session.metadata?.channel;
|
|
151
|
+
const { adapter } = typeof kind === 'string'
|
|
152
|
+
? channelCarrying(kind, agentId, (candidate) => candidate.requestCredential !== undefined
|
|
153
|
+
&& (request.replace !== true || candidate.credentialReplaceForms === true)
|
|
154
|
+
// A form that can't say the key will be shell-readable must not
|
|
155
|
+
// be the approval for it: a link says it instead.
|
|
156
|
+
&& (request.env === undefined || candidate.credentialEnvForms === true))
|
|
157
|
+
: { adapter: undefined };
|
|
158
|
+
if (!adapter?.requestCredential || !session.metadata) {
|
|
159
|
+
formUnavailable = typeof kind === 'string'
|
|
160
|
+
? `This conversation's channel (${kind}) cannot show your operator a ${request.replace === true ? 'replacement' : 'credential'} form here${request.env !== undefined ? ' that says which variable your shell will read it from' : ''}.`
|
|
161
|
+
: 'This conversation is not in a channel that can show your operator a form.';
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
const requestId = randomUUID();
|
|
165
|
+
credentialRequests.set(requestId, { ...record, via: 'form' });
|
|
166
|
+
// Delivered before it is announced, and dropped if delivery fails: a
|
|
167
|
+
// request whose post never landed has no button to answer it, so
|
|
168
|
+
// keeping it would leave it pending for good behind a tool result
|
|
169
|
+
// saying the operator was asked.
|
|
170
|
+
try {
|
|
171
|
+
await adapter.requestCredential({
|
|
172
|
+
sessionId: session.id,
|
|
173
|
+
agentId,
|
|
174
|
+
requestId,
|
|
175
|
+
name: request.name,
|
|
176
|
+
scope: request.scope,
|
|
177
|
+
...(request.reason !== undefined ? { reason: request.reason } : {}),
|
|
178
|
+
...(request.replace === true ? { replace: true } : {}),
|
|
179
|
+
...(request.env !== undefined ? { env: request.env } : {}),
|
|
180
|
+
metadata: session.metadata,
|
|
181
|
+
});
|
|
182
|
+
await announce(requestId, 'form');
|
|
183
|
+
return { requestId, via: 'form' };
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
credentialRequests.delete(requestId);
|
|
187
|
+
formUnavailable = `The form could not be shown here: ${error instanceof Error ? error.message : String(error)}`;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (request.replace === true) {
|
|
191
|
+
// Never a link: whoever holds one could change a key in use.
|
|
192
|
+
throw new Error(`${formUnavailable} Nothing is pending. A replacement needs a conversation that can show an approver a form.`);
|
|
193
|
+
}
|
|
194
|
+
if (request.via === 'form') {
|
|
195
|
+
throw new Error(`${formUnavailable} Nothing is pending. ${linkAllowed ? 'Ask for a link instead (via: "link"), or ask' : 'Ask'} your operator to store ${request.name} on the machine with ${onMachine} and grant it to you.`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (!linkAllowed) {
|
|
199
|
+
throw new Error(`${formUnavailable !== undefined ? `${formUnavailable} ` : ''}A one-time link needs ${CREDENTIAL_REQUEST_TOOL_NAME} in your soul's tools: list, and it is not there. Nothing is pending. `
|
|
200
|
+
+ `Ask in a conversation that can show your operator a form, or ask your operator to store ${request.name} on the machine with ${onMachine} and grant it to you.`);
|
|
201
|
+
}
|
|
202
|
+
// A link where no form can go, from whichever adapter issues them: the
|
|
203
|
+
// control API, which is not tied to any one agent's transport.
|
|
204
|
+
const linker = startedChannels.find((candidate) => candidate.requestCredentialLink !== undefined);
|
|
205
|
+
if (!linker?.requestCredentialLink) {
|
|
206
|
+
throw new Error(`${formUnavailable !== undefined ? `${formUnavailable} ` : ''}No control API is running to issue a link either. `
|
|
207
|
+
+ `Ask your operator to store ${request.name} on the machine with ${onMachine} and grant it to you.`);
|
|
208
|
+
}
|
|
209
|
+
const requestId = randomUUID();
|
|
210
|
+
credentialRequests.set(requestId, { ...record, via: 'link' });
|
|
211
|
+
let link;
|
|
212
|
+
try {
|
|
213
|
+
link = await linker.requestCredentialLink({
|
|
214
|
+
sessionId: session.id,
|
|
215
|
+
agentId,
|
|
216
|
+
agentName: session.agent.name,
|
|
217
|
+
requestId,
|
|
218
|
+
name: request.name,
|
|
219
|
+
scope: request.scope,
|
|
220
|
+
...(request.reason !== undefined ? { reason: request.reason } : {}),
|
|
221
|
+
...(request.env !== undefined ? { env: request.env } : {}),
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
credentialRequests.delete(requestId);
|
|
226
|
+
throw new Error(`A link for ${request.name} could not be issued: ${error instanceof Error ? error.message : String(error)} `
|
|
227
|
+
+ `Nothing is pending. Ask your operator to store it on the machine with ${onMachine}.`);
|
|
228
|
+
}
|
|
229
|
+
await announce(requestId, 'link');
|
|
230
|
+
return {
|
|
231
|
+
requestId,
|
|
232
|
+
via: 'link',
|
|
233
|
+
url: link.url,
|
|
234
|
+
expiresAt: link.expiresAt,
|
|
235
|
+
...(link.localOnly === true ? { localOnly: true } : {}),
|
|
236
|
+
...(formUnavailable !== undefined ? { formUnavailable } : {}),
|
|
237
|
+
};
|
|
238
|
+
}));
|
|
239
|
+
/**
|
|
240
|
+
* Requests an answer is being stored for now. Claimed before the first
|
|
241
|
+
* await: two approvers submitting one form at once would otherwise both
|
|
242
|
+
* start storing, and the second's add-only conflict would retire a
|
|
243
|
+
* request the first was about to settle as added.
|
|
244
|
+
*/
|
|
245
|
+
const answering = new Set();
|
|
246
|
+
const provideCredential = async (input) => {
|
|
247
|
+
const request = credentialRequests.get(input.requestId);
|
|
248
|
+
if (!request) {
|
|
249
|
+
return { ok: false, retired: true, message: 'That credential request is no longer pending. Ask the agent to request it again.' };
|
|
250
|
+
}
|
|
251
|
+
if (answering.has(input.requestId)) {
|
|
252
|
+
return { ok: false, message: 'Someone else\'s answer to this request is being stored right now. Wait a moment before trying again.' };
|
|
253
|
+
}
|
|
254
|
+
answering.add(input.requestId);
|
|
255
|
+
try {
|
|
256
|
+
return await answerCredentialRequest(input, request);
|
|
257
|
+
}
|
|
258
|
+
finally {
|
|
259
|
+
answering.delete(input.requestId);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* The audit line for a key changed from a chat or a link. After the
|
|
264
|
+
* store, since it records what happened; a line that can't be written is
|
|
265
|
+
* warned about rather than undoing a change that already landed.
|
|
266
|
+
*/
|
|
267
|
+
const auditCredentialChange = async (action, request, actor) => {
|
|
268
|
+
try {
|
|
269
|
+
await appendCredentialAudit(env, {
|
|
270
|
+
action,
|
|
271
|
+
name: request.name,
|
|
272
|
+
...(request.scope === 'agent' ? { agentId: request.agentId } : {}),
|
|
273
|
+
...(actor !== undefined ? { actor } : {}),
|
|
274
|
+
via: request.via ?? 'form',
|
|
275
|
+
requestedBy: request.agentId,
|
|
276
|
+
...(request.env !== undefined ? { env: request.env, bindingFor: request.agentId } : {}),
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
warn(`credentials: ${request.name} was ${action === 'add' ? 'added' : 'replaced'}, but the audit line could not be written (${error instanceof Error ? error.message : String(error)}).`);
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
const answerCredentialRequest = async (input, request) => {
|
|
284
|
+
// The agent must still be served from the file the request captured: a
|
|
285
|
+
// repointed default soul (same id, another file) replaces the source,
|
|
286
|
+
// and a grant landing in the old file would report a key the agent now
|
|
287
|
+
// running cannot use.
|
|
288
|
+
const served = sources.get(request.agentId)?.soulPath;
|
|
289
|
+
if (served !== request.soulPath) {
|
|
290
|
+
credentialRequests.delete(input.requestId);
|
|
291
|
+
return {
|
|
292
|
+
ok: false,
|
|
293
|
+
retired: true,
|
|
294
|
+
message: `${request.agentId} is no longer served from ${request.soulPath}, so nothing was stored. Ask ${request.agentId} to request it again.`,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
// The soul the grant will land in must still be the requester's, and is
|
|
298
|
+
// checked before anything is stored: a file reassigned to another agent
|
|
299
|
+
// while the request waited would otherwise receive a key nobody meant
|
|
300
|
+
// to give it. `grantSoulCredential` checks again as it writes.
|
|
301
|
+
let owner;
|
|
302
|
+
try {
|
|
303
|
+
owner = (await loadSoulFile(request.soulPath)).agent.id;
|
|
304
|
+
}
|
|
305
|
+
catch (error) {
|
|
306
|
+
return {
|
|
307
|
+
ok: false,
|
|
308
|
+
message: `${request.agentId}'s soul could not be read (${error instanceof Error ? error.message : String(error)}), so nothing was stored.`,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
if (owner !== request.agentId) {
|
|
312
|
+
credentialRequests.delete(input.requestId);
|
|
313
|
+
return {
|
|
314
|
+
ok: false,
|
|
315
|
+
retired: true,
|
|
316
|
+
message: `${request.soulPath} now belongs to ${owner}, not ${request.agentId}, so nothing was stored. Ask ${request.agentId} to request it again.`,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
const value = formCredentialValue(input.value);
|
|
320
|
+
if (isFlattenedPem(value)) {
|
|
321
|
+
// Refused, not retired: the same form can still take the key whole.
|
|
322
|
+
const command = request.scope === 'agent'
|
|
323
|
+
? `stratus credential set ${request.name} --agent ${quoteShellArg(request.agentId)} < key.pem`
|
|
324
|
+
: `stratus credential set ${request.name} < key.pem`;
|
|
325
|
+
return {
|
|
326
|
+
ok: false,
|
|
327
|
+
message: 'That looks like a PEM key whose line breaks were lost, so nothing was stored: whatever reads it would fail. '
|
|
328
|
+
+ `Paste it again from the original file with its line breaks, or store it on the machine: ${command}.`,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
const store = {
|
|
332
|
+
...(request.scope === 'agent' ? { agentId: request.agentId } : {}),
|
|
333
|
+
// The binding the form promised, written with the value, always for
|
|
334
|
+
// the agent that asked: consent is per agent even for a shared key.
|
|
335
|
+
...(request.env !== undefined ? { bind: { agentId: request.agentId, variable: request.env } } : {}),
|
|
336
|
+
};
|
|
337
|
+
if (request.replace === true) {
|
|
338
|
+
// Re-read under the soul lock, so a grant removed while the form
|
|
339
|
+
// waited (a shared key most of all) is never rotated on its behalf.
|
|
340
|
+
let stillGranted;
|
|
341
|
+
try {
|
|
342
|
+
stillGranted = await withSoulFileLock(async () => {
|
|
343
|
+
const soul = await loadSoulFile(request.soulPath);
|
|
344
|
+
if (soul.agent.id !== request.agentId || soul.agent.credentials?.includes(request.name) !== true) {
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
347
|
+
await replaceNamedCredential(env, { name: request.name, value, ...store });
|
|
348
|
+
return true;
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
catch (error) {
|
|
352
|
+
// Removed since the request was made: no value can land now.
|
|
353
|
+
if (error instanceof NamedCredentialMissingError) {
|
|
354
|
+
credentialRequests.delete(input.requestId);
|
|
355
|
+
return { ok: false, retired: true, message: error.message };
|
|
356
|
+
}
|
|
357
|
+
return { ok: false, message: error instanceof Error ? error.message : String(error) };
|
|
358
|
+
}
|
|
359
|
+
if (!stillGranted) {
|
|
360
|
+
credentialRequests.delete(input.requestId);
|
|
361
|
+
return {
|
|
362
|
+
ok: false,
|
|
363
|
+
retired: true,
|
|
364
|
+
message: `${request.agentId} is no longer granted ${request.name} in ${request.soulPath}, so the stored key was kept. Ask ${request.agentId} to request it again if it still needs it.`,
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
credentialRequests.delete(input.requestId);
|
|
368
|
+
await auditCredentialChange('replace', request, input.actor);
|
|
369
|
+
await bus.emit({
|
|
370
|
+
type: 'credential.provided',
|
|
371
|
+
sessionId: request.sessionId,
|
|
372
|
+
agentId: request.agentId,
|
|
373
|
+
requestId: input.requestId,
|
|
374
|
+
name: request.name,
|
|
375
|
+
scope: request.scope,
|
|
376
|
+
replace: true,
|
|
377
|
+
...(request.env !== undefined ? { env: request.env } : {}),
|
|
378
|
+
...(input.actor !== undefined ? { actor: input.actor } : {}),
|
|
379
|
+
});
|
|
380
|
+
// The soul already lists it: a replace is only asked for a key held.
|
|
381
|
+
return { ok: true, name: request.name, scope: request.scope, agentId: request.agentId, granted: false };
|
|
382
|
+
}
|
|
383
|
+
try {
|
|
384
|
+
await addNamedCredential(env, {
|
|
385
|
+
name: request.name,
|
|
386
|
+
value,
|
|
387
|
+
...store,
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
catch (error) {
|
|
391
|
+
// A name stored since the request was made (another form for the
|
|
392
|
+
// same shared key, or the machine) is final under add-only: no value
|
|
393
|
+
// typed into this form can ever land, so the request is retired
|
|
394
|
+
// rather than left answering every submission with the same refusal.
|
|
395
|
+
if (error instanceof NamedCredentialExistsError) {
|
|
396
|
+
credentialRequests.delete(input.requestId);
|
|
397
|
+
return { ok: false, retired: true, message: error.message };
|
|
398
|
+
}
|
|
399
|
+
// Otherwise refused, not failed: the request stays pending, so a
|
|
400
|
+
// person who typed an empty value can try again from the same form.
|
|
401
|
+
return { ok: false, message: error instanceof Error ? error.message : String(error) };
|
|
402
|
+
}
|
|
403
|
+
credentialRequests.delete(input.requestId);
|
|
404
|
+
await auditCredentialChange('add', request, input.actor);
|
|
405
|
+
// Stored first, granted second: a key nobody may use is recoverable by
|
|
406
|
+
// editing the soul, while a soul naming a key that was never stored
|
|
407
|
+
// fails every call that reaches for it. Announced either way, because
|
|
408
|
+
// the store already changed and a shared key is already usable.
|
|
409
|
+
//
|
|
410
|
+
// The served path is checked again under the soul lock, which roster
|
|
411
|
+
// reloads take too: a default repointed while the key was being
|
|
412
|
+
// written, or while the grant queued behind another soul edit, would
|
|
413
|
+
// otherwise be granted in a file the running agent no longer reads.
|
|
414
|
+
let granted = false;
|
|
415
|
+
let grantError;
|
|
416
|
+
try {
|
|
417
|
+
granted = await grantSoulCredential(request.soulPath, request.name, request.agentId, {
|
|
418
|
+
check: () => {
|
|
419
|
+
const servedNow = sources.get(request.agentId)?.soulPath;
|
|
420
|
+
if (servedNow !== request.soulPath) {
|
|
421
|
+
throw new Error(`${request.agentId} is now served from ${servedNow ?? 'no soul file'}, not ${request.soulPath}`);
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
catch (error) {
|
|
427
|
+
grantError = error instanceof Error ? error.message : String(error);
|
|
428
|
+
}
|
|
429
|
+
await bus.emit({
|
|
430
|
+
type: 'credential.provided',
|
|
431
|
+
sessionId: request.sessionId,
|
|
432
|
+
agentId: request.agentId,
|
|
433
|
+
requestId: input.requestId,
|
|
434
|
+
name: request.name,
|
|
435
|
+
scope: request.scope,
|
|
436
|
+
...(request.env !== undefined ? { env: request.env } : {}),
|
|
437
|
+
...(input.actor !== undefined ? { actor: input.actor } : {}),
|
|
438
|
+
...(grantError !== undefined ? { grantError } : {}),
|
|
439
|
+
});
|
|
440
|
+
if (grantError !== undefined) {
|
|
441
|
+
return {
|
|
442
|
+
ok: false,
|
|
443
|
+
retired: true,
|
|
444
|
+
message: `${request.name} was stored, but could not be added to ${request.soulPath} `
|
|
445
|
+
+ `(${grantError}). Add it to the soul's credentials list by hand.`,
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
return { ok: true, name: request.name, scope: request.scope, agentId: request.agentId, granted };
|
|
449
|
+
};
|
|
450
|
+
return { provideCredential };
|
|
451
|
+
};
|
|
452
|
+
//# sourceMappingURL=credential-requests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-requests.js","sourceRoot":"","sources":["../src/credential-requests.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAKL,oBAAoB,GAGrB,MAAM,oBAAoB,CAA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;IAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC/B,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Session } from '@stratusagent/core';
|
|
2
|
+
import { type MergeBatch } from './merge-batch.ts';
|
|
3
|
+
import type { ShardedSessionStore } from './sessions.ts';
|
|
4
|
+
import { type IntakeState } from './lifecycle.ts';
|
|
5
|
+
import type { DispatchInput } from './types.ts';
|
|
6
|
+
import type { TurnDispatch } from './turn-dispatch.ts';
|
|
7
|
+
import type { Recovery } from './recovery.ts';
|
|
8
|
+
import type { Steering } from './steering.ts';
|
|
9
|
+
/** What `dispatch` closes over in `createGateway`. */
|
|
10
|
+
export interface DispatchDeps extends Pick<TurnDispatch, 'dispatchInternal'>, Pick<Recovery, 'settleRepeat'>, Pick<Steering, 'takeSteered'> {
|
|
11
|
+
store: ShardedSessionStore;
|
|
12
|
+
sessionChains: Map<string, Promise<unknown>>;
|
|
13
|
+
queuedWork: Map<string, number>;
|
|
14
|
+
waitingDispatches: Map<string, number>;
|
|
15
|
+
isStopping: () => boolean;
|
|
16
|
+
getIntakeState: () => IntakeState;
|
|
17
|
+
isHeld: () => boolean;
|
|
18
|
+
refusal: () => Error;
|
|
19
|
+
activeTurns: Map<string, string>;
|
|
20
|
+
liveWorkItems: Map<string, Map<string, {
|
|
21
|
+
turn: Promise<Session>;
|
|
22
|
+
agentId: string | undefined;
|
|
23
|
+
confirmed: boolean;
|
|
24
|
+
addressed: boolean;
|
|
25
|
+
}>>;
|
|
26
|
+
openBatches: Map<string, MergeBatch>;
|
|
27
|
+
settleOrphanedItem: (sessionId: string) => Promise<void>;
|
|
28
|
+
onSessionChain: <T>(sessionId: string, work: () => Promise<T>, released?: () => boolean) => Promise<T>;
|
|
29
|
+
}
|
|
30
|
+
export declare const createDispatch: ({ store, sessionChains, queuedWork, waitingDispatches, isStopping, getIntakeState, isHeld, refusal, activeTurns, liveWorkItems, openBatches, settleOrphanedItem, onSessionChain, dispatchInternal, settleRepeat, takeSteered, }: DispatchDeps) => {
|
|
31
|
+
dispatch: (input: DispatchInput) => Promise<Session>;
|
|
32
|
+
};
|
|
33
|
+
export type Dispatch = ReturnType<typeof createDispatch>;
|
|
34
|
+
//# sourceMappingURL=dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAWA,OAAO,EAML,KAAK,OAAO,EAGb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAIL,KAAK,UAAU,EAIhB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAA2D,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC3G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAOhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,sDAAsD;AACtD,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,YAAY,EAAE,kBAAkB,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC;IACzI,KAAK,EAAE,mBAAmB,CAAC;IAC3B,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7C,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,UAAU,EAAE,MAAM,OAAO,CAAC;IAC1B,cAAc,EAAE,MAAM,WAAW,CAAC;IAClC,MAAM,EAAE,MAA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