agentfootprint 9.35.0 → 9.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/hosting/firestoreSessions.js +28 -6
- package/dist/adapters/hosting/firestoreSessions.js.map +1 -1
- package/dist/adapters/hosting/googleAgentEngine.js +64 -0
- package/dist/adapters/hosting/googleAgentEngine.js.map +1 -1
- package/dist/adapters/memory/agentcore.js +7 -1
- package/dist/adapters/memory/agentcore.js.map +1 -1
- package/dist/adapters/memory/memoryBank.js +29 -8
- package/dist/adapters/memory/memoryBank.js.map +1 -1
- package/dist/adapters/memory/redis.js +28 -1
- package/dist/adapters/memory/redis.js.map +1 -1
- package/dist/artifacts/scopePath.js +13 -2
- package/dist/artifacts/scopePath.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +85 -0
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/buildToolRegistry.js +7 -0
- package/dist/core/agent/buildToolRegistry.js.map +1 -1
- package/dist/core/agent/toolsFromActiveSkill.js +79 -0
- package/dist/core/agent/toolsFromActiveSkill.js.map +1 -0
- package/dist/esm/adapters/hosting/firestoreSessions.js +29 -7
- package/dist/esm/adapters/hosting/firestoreSessions.js.map +1 -1
- package/dist/esm/adapters/hosting/googleAgentEngine.js +64 -0
- package/dist/esm/adapters/hosting/googleAgentEngine.js.map +1 -1
- package/dist/esm/adapters/memory/agentcore.js +7 -1
- package/dist/esm/adapters/memory/agentcore.js.map +1 -1
- package/dist/esm/adapters/memory/memoryBank.d.ts +13 -3
- package/dist/esm/adapters/memory/memoryBank.js +29 -8
- package/dist/esm/adapters/memory/memoryBank.js.map +1 -1
- package/dist/esm/adapters/memory/redis.d.ts +25 -0
- package/dist/esm/adapters/memory/redis.js +28 -1
- package/dist/esm/adapters/memory/redis.js.map +1 -1
- package/dist/esm/artifacts/scopePath.d.ts +9 -1
- package/dist/esm/artifacts/scopePath.js +13 -2
- package/dist/esm/artifacts/scopePath.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.d.ts +62 -0
- package/dist/esm/core/agent/AgentBuilder.js +85 -0
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/buildToolRegistry.js +7 -0
- package/dist/esm/core/agent/buildToolRegistry.js.map +1 -1
- package/dist/esm/core/agent/toolsFromActiveSkill.d.ts +55 -0
- package/dist/esm/core/agent/toolsFromActiveSkill.js +75 -0
- package/dist/esm/core/agent/toolsFromActiveSkill.js.map +1 -0
- package/dist/esm/hosting/conformance/cases.d.ts +15 -0
- package/dist/esm/hosting/conformance/cases.js +395 -0
- package/dist/esm/hosting/conformance/cases.js.map +1 -0
- package/dist/esm/hosting/conformance/index.d.ts +11 -0
- package/dist/esm/hosting/conformance/index.js +11 -0
- package/dist/esm/hosting/conformance/index.js.map +1 -0
- package/dist/esm/hosting/conformance/run.d.ts +46 -0
- package/dist/esm/hosting/conformance/run.js +182 -0
- package/dist/esm/hosting/conformance/run.js.map +1 -0
- package/dist/esm/hosting/conformance/types.d.ts +140 -0
- package/dist/esm/hosting/conformance/types.js +6 -0
- package/dist/esm/hosting/conformance/types.js.map +1 -0
- package/dist/esm/hosting/errors.d.ts +34 -0
- package/dist/esm/hosting/errors.js +47 -0
- package/dist/esm/hosting/errors.js.map +1 -1
- package/dist/esm/hosting/index.d.ts +4 -1
- package/dist/esm/hosting/index.js +11 -1
- package/dist/esm/hosting/index.js.map +1 -1
- package/dist/esm/hosting/memorySessions.d.ts +5 -0
- package/dist/esm/hosting/memorySessions.js +25 -17
- package/dist/esm/hosting/memorySessions.js.map +1 -1
- package/dist/esm/hosting/sessionOwnership.d.ts +86 -0
- package/dist/esm/hosting/sessionOwnership.js +106 -0
- package/dist/esm/hosting/sessionOwnership.js.map +1 -0
- package/dist/esm/hosting/sqliteSessions.js +41 -10
- package/dist/esm/hosting/sqliteSessions.js.map +1 -1
- package/dist/esm/hosting/types.d.ts +68 -4
- package/dist/esm/hosting/types.js.map +1 -1
- package/dist/esm/lib/injection-engine/factories/defineSkill.d.ts +7 -0
- package/dist/esm/lib/injection-engine/factories/defineSkill.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillsFromDir.d.ts +80 -17
- package/dist/esm/lib/injection-engine/skillsFromDir.js +348 -46
- package/dist/esm/lib/injection-engine/skillsFromDir.js.map +1 -1
- package/dist/esm/memory/identity/encode.d.ts +67 -0
- package/dist/esm/memory/identity/encode.js +91 -0
- package/dist/esm/memory/identity/encode.js.map +1 -0
- package/dist/esm/memory/identity/index.d.ts +1 -0
- package/dist/esm/memory/identity/index.js +1 -0
- package/dist/esm/memory/identity/index.js.map +1 -1
- package/dist/esm/memory/identity/types.d.ts +21 -4
- package/dist/esm/memory/identity/types.js +27 -7
- package/dist/esm/memory/identity/types.js.map +1 -1
- package/dist/hosting/conformance/cases.js +398 -0
- package/dist/hosting/conformance/cases.js.map +1 -0
- package/dist/hosting/conformance/index.js +18 -0
- package/dist/hosting/conformance/index.js.map +1 -0
- package/dist/hosting/conformance/run.js +188 -0
- package/dist/hosting/conformance/run.js.map +1 -0
- package/dist/hosting/conformance/types.js +7 -0
- package/dist/hosting/conformance/types.js.map +1 -0
- package/dist/hosting/errors.js +49 -1
- package/dist/hosting/errors.js.map +1 -1
- package/dist/hosting/index.js +18 -2
- package/dist/hosting/index.js.map +1 -1
- package/dist/hosting/memorySessions.js +25 -17
- package/dist/hosting/memorySessions.js.map +1 -1
- package/dist/hosting/sessionOwnership.js +110 -0
- package/dist/hosting/sessionOwnership.js.map +1 -0
- package/dist/hosting/sqliteSessions.js +41 -10
- package/dist/hosting/sqliteSessions.js.map +1 -1
- package/dist/hosting/types.js.map +1 -1
- package/dist/lib/injection-engine/factories/defineSkill.js.map +1 -1
- package/dist/lib/injection-engine/skillsFromDir.js +348 -46
- package/dist/lib/injection-engine/skillsFromDir.js.map +1 -1
- package/dist/memory/identity/encode.js +96 -0
- package/dist/memory/identity/encode.js.map +1 -0
- package/dist/memory/identity/index.js +5 -1
- package/dist/memory/identity/index.js.map +1 -1
- package/dist/memory/identity/types.js +27 -7
- package/dist/memory/identity/types.js.map +1 -1
- package/dist/types/adapters/hosting/firestoreSessions.d.ts.map +1 -1
- package/dist/types/adapters/hosting/googleAgentEngine.d.ts.map +1 -1
- package/dist/types/adapters/memory/agentcore.d.ts.map +1 -1
- package/dist/types/adapters/memory/memoryBank.d.ts +13 -3
- package/dist/types/adapters/memory/memoryBank.d.ts.map +1 -1
- package/dist/types/adapters/memory/redis.d.ts +25 -0
- package/dist/types/adapters/memory/redis.d.ts.map +1 -1
- package/dist/types/artifacts/scopePath.d.ts +9 -1
- package/dist/types/artifacts/scopePath.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +62 -0
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/buildToolRegistry.d.ts.map +1 -1
- package/dist/types/core/agent/toolsFromActiveSkill.d.ts +56 -0
- package/dist/types/core/agent/toolsFromActiveSkill.d.ts.map +1 -0
- package/dist/types/hosting/conformance/cases.d.ts +16 -0
- package/dist/types/hosting/conformance/cases.d.ts.map +1 -0
- package/dist/types/hosting/conformance/index.d.ts +12 -0
- package/dist/types/hosting/conformance/index.d.ts.map +1 -0
- package/dist/types/hosting/conformance/run.d.ts +47 -0
- package/dist/types/hosting/conformance/run.d.ts.map +1 -0
- package/dist/types/hosting/conformance/types.d.ts +141 -0
- package/dist/types/hosting/conformance/types.d.ts.map +1 -0
- package/dist/types/hosting/errors.d.ts +34 -0
- package/dist/types/hosting/errors.d.ts.map +1 -1
- package/dist/types/hosting/index.d.ts +4 -1
- package/dist/types/hosting/index.d.ts.map +1 -1
- package/dist/types/hosting/memorySessions.d.ts +5 -0
- package/dist/types/hosting/memorySessions.d.ts.map +1 -1
- package/dist/types/hosting/sessionOwnership.d.ts +87 -0
- package/dist/types/hosting/sessionOwnership.d.ts.map +1 -0
- package/dist/types/hosting/sqliteSessions.d.ts.map +1 -1
- package/dist/types/hosting/types.d.ts +68 -4
- package/dist/types/hosting/types.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/factories/defineSkill.d.ts +7 -0
- package/dist/types/lib/injection-engine/factories/defineSkill.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillsFromDir.d.ts +80 -17
- package/dist/types/lib/injection-engine/skillsFromDir.d.ts.map +1 -1
- package/dist/types/memory/identity/encode.d.ts +68 -0
- package/dist/types/memory/identity/encode.d.ts.map +1 -0
- package/dist/types/memory/identity/index.d.ts +1 -0
- package/dist/types/memory/identity/index.d.ts.map +1 -1
- package/dist/types/memory/identity/types.d.ts +21 -4
- package/dist/types/memory/identity/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hosting/sessionOwnership — the ONE owner-transition rule, so four stores
|
|
3
|
+
* cannot each get it slightly wrong (9.36.1).
|
|
4
|
+
*
|
|
5
|
+
* Every store implementing {@link SessionLifecycle} keeps an owner index, and
|
|
6
|
+
* every one of them wrote the write-once rule out longhand in its own dialect:
|
|
7
|
+
* a `COALESCE` in SQL, a `has()` on a `Map`, a read-then-decide inside a
|
|
8
|
+
* transaction. Four spellings of one sentence, and all four were missing the
|
|
9
|
+
* same half of it — which is what a rule that lives in prose rather than in
|
|
10
|
+
* code eventually costs.
|
|
11
|
+
*
|
|
12
|
+
* ── The rule, whole ─────────────────────────────────────────────────────────
|
|
13
|
+
* An owner is a fact about the CONVERSATION, established by the first turn
|
|
14
|
+
* that signs for it. Given what is stored and what a turn is carrying:
|
|
15
|
+
*
|
|
16
|
+
* | stored | incoming | outcome |
|
|
17
|
+
* |------------|------------|-----------------------------------------------|
|
|
18
|
+
* | nobody | nobody | still nobody — an anonymous conversation |
|
|
19
|
+
* | nobody | somebody | FILLED IN — the first turn that signs, owns |
|
|
20
|
+
* | somebody | nobody | KEPT — a leaner turn erases nothing |
|
|
21
|
+
* | somebody | the same | KEPT — the ordinary turn |
|
|
22
|
+
* | somebody | DIFFERENT | REFUSED, by name |
|
|
23
|
+
*
|
|
24
|
+
* The last row is the one that was missing, and the difference between the
|
|
25
|
+
* last two rows is the whole design decision:
|
|
26
|
+
*
|
|
27
|
+
* - **A different identity is a CONTRADICTION.** Two people cannot both have
|
|
28
|
+
* signed for one conversation. Keeping the index and storing the payload
|
|
29
|
+
* anyway — which is what every store did — leaves the index naming one
|
|
30
|
+
* person and the conversation naming another, and the person the index
|
|
31
|
+
* names opens it and reads the other one's conversation.
|
|
32
|
+
* - **An absent identity is not a contradiction.** It claims nobody. The
|
|
33
|
+
* contract blesses it in as many words ("a later turn carrying a leaner
|
|
34
|
+
* identity must not erase it"), and refusing it would fail a flow the
|
|
35
|
+
* library's own documentation describes as intended, to protect against a
|
|
36
|
+
* claim nobody made.
|
|
37
|
+
*
|
|
38
|
+
* ── Why this is a function and not a base class ─────────────────────────────
|
|
39
|
+
* Stores share no ancestry and should not start now: one is a `Map`, one is a
|
|
40
|
+
* SQL upsert, one is a distributed transaction, one is somebody's managed
|
|
41
|
+
* service where the owner field is immutable. What they share is a DECISION,
|
|
42
|
+
* so what they share is a decision function — called at the point each of them
|
|
43
|
+
* already had to decide, inside whatever atomicity that store can offer.
|
|
44
|
+
*
|
|
45
|
+
* The atomicity is deliberately NOT this module's business, and cannot be: a
|
|
46
|
+
* read-then-decide is only as safe as the transaction it happens inside, and
|
|
47
|
+
* only the store knows what it has. What this owns is the answer; where it is
|
|
48
|
+
* safe to ask is the store's own promise, and the conformance suite is what
|
|
49
|
+
* checks that the store kept it (`contested-write-leaves-no-split-brain`).
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* Which owner a store should record, given what it already has and what the
|
|
53
|
+
* turn being written is signed by — or a refusal.
|
|
54
|
+
*
|
|
55
|
+
* Call it INSIDE whatever the store uses to make read-then-write atomic (a
|
|
56
|
+
* transaction, a lock, a single-threaded map), with the owner already derived
|
|
57
|
+
* from the stored conversation by `envelopeOwner`. The return value is the
|
|
58
|
+
* owner to store; a refusal means the whole `persist` must not land, including
|
|
59
|
+
* the envelope.
|
|
60
|
+
*
|
|
61
|
+
* **The envelope is the part that matters.** A store that catches this and
|
|
62
|
+
* writes the payload anyway has re-created the exact defect: the refusal
|
|
63
|
+
* exists to stop the CONVERSATION being replaced, not merely to protect an
|
|
64
|
+
* index column.
|
|
65
|
+
*
|
|
66
|
+
* Empty strings are read as "nobody" on both sides, matching `envelopeOwner`,
|
|
67
|
+
* so a store that keeps `''` for an unowned row cannot accidentally make it a
|
|
68
|
+
* principal that conflicts with everybody.
|
|
69
|
+
*
|
|
70
|
+
* @param sessionId the id being written — the caller's own string, and the
|
|
71
|
+
* only thing the refusal repeats back.
|
|
72
|
+
* @param storedOwner the owner already recorded for this session, or
|
|
73
|
+
* `undefined` for a session that is new or that nobody has signed for.
|
|
74
|
+
* @param incomingOwner the owner derived from the envelope being written —
|
|
75
|
+
* `envelopeOwner(envelope)`, never anything a caller supplied.
|
|
76
|
+
* @returns the owner to record. `undefined` means "record nobody".
|
|
77
|
+
* @throws SessionOwnershipConflictError when the two name DIFFERENT people.
|
|
78
|
+
*
|
|
79
|
+
* @example Inside a store's persist
|
|
80
|
+
* const incoming = envelopeOwner(checked);
|
|
81
|
+
* const owner = resolveSessionOwner(sessionId, rows.get(sessionId), incoming);
|
|
82
|
+
* // Only now — a refusal above must leave the stored conversation alone.
|
|
83
|
+
* rows.set(sessionId, checked);
|
|
84
|
+
* if (owner !== undefined) owners.set(sessionId, owner);
|
|
85
|
+
*/
|
|
86
|
+
export declare function resolveSessionOwner(sessionId: string, storedOwner: string | undefined, incomingOwner: string | undefined): string | undefined;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hosting/sessionOwnership — the ONE owner-transition rule, so four stores
|
|
3
|
+
* cannot each get it slightly wrong (9.36.1).
|
|
4
|
+
*
|
|
5
|
+
* Every store implementing {@link SessionLifecycle} keeps an owner index, and
|
|
6
|
+
* every one of them wrote the write-once rule out longhand in its own dialect:
|
|
7
|
+
* a `COALESCE` in SQL, a `has()` on a `Map`, a read-then-decide inside a
|
|
8
|
+
* transaction. Four spellings of one sentence, and all four were missing the
|
|
9
|
+
* same half of it — which is what a rule that lives in prose rather than in
|
|
10
|
+
* code eventually costs.
|
|
11
|
+
*
|
|
12
|
+
* ── The rule, whole ─────────────────────────────────────────────────────────
|
|
13
|
+
* An owner is a fact about the CONVERSATION, established by the first turn
|
|
14
|
+
* that signs for it. Given what is stored and what a turn is carrying:
|
|
15
|
+
*
|
|
16
|
+
* | stored | incoming | outcome |
|
|
17
|
+
* |------------|------------|-----------------------------------------------|
|
|
18
|
+
* | nobody | nobody | still nobody — an anonymous conversation |
|
|
19
|
+
* | nobody | somebody | FILLED IN — the first turn that signs, owns |
|
|
20
|
+
* | somebody | nobody | KEPT — a leaner turn erases nothing |
|
|
21
|
+
* | somebody | the same | KEPT — the ordinary turn |
|
|
22
|
+
* | somebody | DIFFERENT | REFUSED, by name |
|
|
23
|
+
*
|
|
24
|
+
* The last row is the one that was missing, and the difference between the
|
|
25
|
+
* last two rows is the whole design decision:
|
|
26
|
+
*
|
|
27
|
+
* - **A different identity is a CONTRADICTION.** Two people cannot both have
|
|
28
|
+
* signed for one conversation. Keeping the index and storing the payload
|
|
29
|
+
* anyway — which is what every store did — leaves the index naming one
|
|
30
|
+
* person and the conversation naming another, and the person the index
|
|
31
|
+
* names opens it and reads the other one's conversation.
|
|
32
|
+
* - **An absent identity is not a contradiction.** It claims nobody. The
|
|
33
|
+
* contract blesses it in as many words ("a later turn carrying a leaner
|
|
34
|
+
* identity must not erase it"), and refusing it would fail a flow the
|
|
35
|
+
* library's own documentation describes as intended, to protect against a
|
|
36
|
+
* claim nobody made.
|
|
37
|
+
*
|
|
38
|
+
* ── Why this is a function and not a base class ─────────────────────────────
|
|
39
|
+
* Stores share no ancestry and should not start now: one is a `Map`, one is a
|
|
40
|
+
* SQL upsert, one is a distributed transaction, one is somebody's managed
|
|
41
|
+
* service where the owner field is immutable. What they share is a DECISION,
|
|
42
|
+
* so what they share is a decision function — called at the point each of them
|
|
43
|
+
* already had to decide, inside whatever atomicity that store can offer.
|
|
44
|
+
*
|
|
45
|
+
* The atomicity is deliberately NOT this module's business, and cannot be: a
|
|
46
|
+
* read-then-decide is only as safe as the transaction it happens inside, and
|
|
47
|
+
* only the store knows what it has. What this owns is the answer; where it is
|
|
48
|
+
* safe to ask is the store's own promise, and the conformance suite is what
|
|
49
|
+
* checks that the store kept it (`contested-write-leaves-no-split-brain`).
|
|
50
|
+
*/
|
|
51
|
+
import { SessionOwnershipConflictError } from './errors.js';
|
|
52
|
+
/**
|
|
53
|
+
* Which owner a store should record, given what it already has and what the
|
|
54
|
+
* turn being written is signed by — or a refusal.
|
|
55
|
+
*
|
|
56
|
+
* Call it INSIDE whatever the store uses to make read-then-write atomic (a
|
|
57
|
+
* transaction, a lock, a single-threaded map), with the owner already derived
|
|
58
|
+
* from the stored conversation by `envelopeOwner`. The return value is the
|
|
59
|
+
* owner to store; a refusal means the whole `persist` must not land, including
|
|
60
|
+
* the envelope.
|
|
61
|
+
*
|
|
62
|
+
* **The envelope is the part that matters.** A store that catches this and
|
|
63
|
+
* writes the payload anyway has re-created the exact defect: the refusal
|
|
64
|
+
* exists to stop the CONVERSATION being replaced, not merely to protect an
|
|
65
|
+
* index column.
|
|
66
|
+
*
|
|
67
|
+
* Empty strings are read as "nobody" on both sides, matching `envelopeOwner`,
|
|
68
|
+
* so a store that keeps `''` for an unowned row cannot accidentally make it a
|
|
69
|
+
* principal that conflicts with everybody.
|
|
70
|
+
*
|
|
71
|
+
* @param sessionId the id being written — the caller's own string, and the
|
|
72
|
+
* only thing the refusal repeats back.
|
|
73
|
+
* @param storedOwner the owner already recorded for this session, or
|
|
74
|
+
* `undefined` for a session that is new or that nobody has signed for.
|
|
75
|
+
* @param incomingOwner the owner derived from the envelope being written —
|
|
76
|
+
* `envelopeOwner(envelope)`, never anything a caller supplied.
|
|
77
|
+
* @returns the owner to record. `undefined` means "record nobody".
|
|
78
|
+
* @throws SessionOwnershipConflictError when the two name DIFFERENT people.
|
|
79
|
+
*
|
|
80
|
+
* @example Inside a store's persist
|
|
81
|
+
* const incoming = envelopeOwner(checked);
|
|
82
|
+
* const owner = resolveSessionOwner(sessionId, rows.get(sessionId), incoming);
|
|
83
|
+
* // Only now — a refusal above must leave the stored conversation alone.
|
|
84
|
+
* rows.set(sessionId, checked);
|
|
85
|
+
* if (owner !== undefined) owners.set(sessionId, owner);
|
|
86
|
+
*/
|
|
87
|
+
export function resolveSessionOwner(sessionId, storedOwner, incomingOwner) {
|
|
88
|
+
const stored = nonEmpty(storedOwner);
|
|
89
|
+
const incoming = nonEmpty(incomingOwner);
|
|
90
|
+
// Nothing is claimed yet: the first turn that signs owns the conversation,
|
|
91
|
+
// and a turn that signs for nothing leaves it unowned.
|
|
92
|
+
if (stored === undefined)
|
|
93
|
+
return incoming;
|
|
94
|
+
// The blessed leaner turn. It claims nobody, so it contradicts nobody, and
|
|
95
|
+
// the established owner stands.
|
|
96
|
+
if (incoming === undefined)
|
|
97
|
+
return stored;
|
|
98
|
+
if (incoming === stored)
|
|
99
|
+
return stored;
|
|
100
|
+
throw new SessionOwnershipConflictError(sessionId);
|
|
101
|
+
}
|
|
102
|
+
/** `''` is nobody, exactly as `envelopeOwner` reads it. */
|
|
103
|
+
function nonEmpty(value) {
|
|
104
|
+
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=sessionOwnership.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionOwnership.js","sourceRoot":"","sources":["../../../src/hosting/sessionOwnership.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,UAAU,mBAAmB,CACjC,SAAiB,EACjB,WAA+B,EAC/B,aAAiC;IAEjC,MAAM,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IACzC,2EAA2E;IAC3E,uDAAuD;IACvD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IAC1C,2EAA2E;IAC3E,gCAAgC;IAChC,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IAC1C,IAAI,QAAQ,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IACvC,MAAM,IAAI,6BAA6B,CAAC,SAAS,CAAC,CAAC;AACrD,CAAC;AAED,2DAA2D;AAC3D,SAAS,QAAQ,CAAC,KAAyB;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC"}
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
*/
|
|
55
55
|
import { checkEnvelope, envelopeOwner, envelopeTranscript } from './envelope.js';
|
|
56
56
|
import { UnreadableEnvelopeError } from './errors.js';
|
|
57
|
+
import { resolveSessionOwner } from './sessionOwnership.js';
|
|
57
58
|
import { lazyRequire } from '../lib/lazyRequire.js';
|
|
58
59
|
import { SqliteUnavailableError } from '../lib/sqliteUnavailable.js';
|
|
59
60
|
// ─── The refusals ────────────────────────────────────────────────────
|
|
@@ -216,14 +217,17 @@ export function sqliteSessions(options) {
|
|
|
216
217
|
`VALUES (?, ?, ?, ?, ?, ?) ` +
|
|
217
218
|
`ON CONFLICT(session_id) DO UPDATE SET format = excluded.format, ` +
|
|
218
219
|
`saved_at = excluded.saved_at, envelope = excluded.envelope, ` +
|
|
219
|
-
//
|
|
220
|
-
//
|
|
221
|
-
//
|
|
222
|
-
//
|
|
223
|
-
//
|
|
224
|
-
//
|
|
225
|
-
//
|
|
226
|
-
|
|
220
|
+
// The owner is bound, already decided — NOT `COALESCE(sessions.owner,
|
|
221
|
+
// excluded.owner)`, which is what this was until 9.36.1.
|
|
222
|
+
//
|
|
223
|
+
// COALESCE kept the right owner and could not refuse, so a turn signed
|
|
224
|
+
// by somebody else quietly won the `envelope` column beside an `owner`
|
|
225
|
+
// column that still named the first writer: the index said one person
|
|
226
|
+
// and the stored conversation said another. SQL that can only pick a
|
|
227
|
+
// column cannot express "and if they disagree, write nothing" — so the
|
|
228
|
+
// decision moved out of the statement and into `resolveSessionOwner`,
|
|
229
|
+
// one transaction up, where a refusal can stop the whole row.
|
|
230
|
+
`owner = excluded.owner, ` +
|
|
227
231
|
`message_count = excluded.message_count`);
|
|
228
232
|
const select = db.prepare(`SELECT envelope FROM ${SESSIONS_TABLE} WHERE session_id = ?`);
|
|
229
233
|
const remove = db.prepare(`DELETE FROM ${SESSIONS_TABLE} WHERE session_id = ?`);
|
|
@@ -284,8 +288,35 @@ export function sqliteSessions(options) {
|
|
|
284
288
|
// never supplied by the caller — the port takes no owner argument and
|
|
285
289
|
// gains none, because a store where owning a session is a matter of
|
|
286
290
|
// asking is not an index, it is a formality.
|
|
287
|
-
const
|
|
288
|
-
|
|
291
|
+
const incoming = envelopeOwner(checked);
|
|
292
|
+
// BEGIN IMMEDIATE, not BEGIN: it takes the write lock up front, so the
|
|
293
|
+
// read below and the write after it cannot have another writer's turn
|
|
294
|
+
// between them. A deferred transaction would take the lock only at the
|
|
295
|
+
// INSERT — which is exactly the window where two containers persisting
|
|
296
|
+
// the same fresh session both read "nobody owns this" and both proceed.
|
|
297
|
+
// The lock waits `busy_timeout` and then fails loudly, which is the same
|
|
298
|
+
// bargain the rest of this store makes.
|
|
299
|
+
db.exec('BEGIN IMMEDIATE');
|
|
300
|
+
try {
|
|
301
|
+
const existing = selectOwner.get(sessionId);
|
|
302
|
+
const owner = resolveSessionOwner(sessionId, typeof existing?.owner === 'string' ? existing.owner : undefined, incoming);
|
|
303
|
+
insert.run(sessionId, checked.format, checked.savedAt, JSON.stringify(checked), owner ?? null, envelopeTranscript(checked).length);
|
|
304
|
+
db.exec('COMMIT');
|
|
305
|
+
}
|
|
306
|
+
catch (err) {
|
|
307
|
+
// The envelope must not land when the owner was refused — the payload
|
|
308
|
+
// is the half that carries somebody's conversation, and a row that
|
|
309
|
+
// kept the old owner beside a new conversation is the whole defect.
|
|
310
|
+
// ROLLBACK is best-effort: if the transaction is already gone the
|
|
311
|
+
// original refusal is the one worth raising, not this one.
|
|
312
|
+
try {
|
|
313
|
+
db.exec('ROLLBACK');
|
|
314
|
+
}
|
|
315
|
+
catch {
|
|
316
|
+
/* Already rolled back or never opened; the error below says why. */
|
|
317
|
+
}
|
|
318
|
+
throw err;
|
|
319
|
+
}
|
|
289
320
|
},
|
|
290
321
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
291
322
|
async listByUser(userId, options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqliteSessions.js","sourceRoot":"","sources":["../../../src/hosting/sqliteSessions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAgGrE,wEAAwE;AAExE;;;;;;;;;GASG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAC1C,IAAI,GAAG,6BAAsC,CAAC;IACvD,iCAAiC;IACxB,I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,CACrC,CAAC;IACJ,CAAC;AACH,CAAC;AAED,kFAAkF;AAClF,SAAS,QAAQ,CAAC,GAAY;IAC5B,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC;AAED,kFAAkF;AAClF,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB;;;;;;;;;GASG;AACH,SAAS,WAAW,CAAC,MAA0B;IAC7C,MAAM,GAAG,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,gBAAgB,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IAChE,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC;IACrC,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,EAAE,IAAI,CAAC;QAAE,OAAO,GAAG,CAAC;IACxB,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACzD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,GAAG,CAAC;IAC1C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -656,11 +656,40 @@ export type WakeReason = 'invoke' | 'resume' | 'artifact' | 'transcript';
|
|
|
656
656
|
* Deliberately two required methods. Anything a real store also wants — a TTL,
|
|
657
657
|
* a scan, a delete — is that store's own API, not a demand this port makes of
|
|
658
658
|
* every store that will ever implement it.
|
|
659
|
+
*
|
|
660
|
+
* ── Claiming the port ───────────────────────────────────────────────────────
|
|
661
|
+
* The two required methods are what TypeScript checks. What a store has to
|
|
662
|
+
* *behave* like is a battery every shipped store runs against and any store
|
|
663
|
+
* can: `sessionLifecycleConformance`, exported from this same subpath. It was
|
|
664
|
+
* written after a flaw in THIS interface's semantics turned up in four
|
|
665
|
+
* independent adapters at once — every one of them tested, and every one of
|
|
666
|
+
* them tested only against its own doubles, which is precisely why none of
|
|
667
|
+
* them could see it. Run it against your store; a case your store cannot
|
|
668
|
+
* satisfy is DECLARED by name with its reason, never skipped.
|
|
659
669
|
*/
|
|
660
670
|
export interface SessionLifecycle {
|
|
661
671
|
/** The stored conversation, or `undefined` for a session that has none yet. */
|
|
662
672
|
hydrate(sessionId: string): Promise<CheckpointEnvelope | undefined>;
|
|
663
|
-
/**
|
|
673
|
+
/**
|
|
674
|
+
* Store the conversation for this session. Last write wins — with ONE
|
|
675
|
+
* exception, and it is the only thing this method ever refuses.
|
|
676
|
+
*
|
|
677
|
+
* **A store that keeps an owner index refuses a turn signed by somebody
|
|
678
|
+
* other than the established owner** (`SessionOwnershipConflictError`,
|
|
679
|
+
* 9.36.1), and refuses it whole: neither the index nor the ENVELOPE changes.
|
|
680
|
+
* Until 9.36.1 the write-once rule protected only the index, so such a write
|
|
681
|
+
* kept the first writer's `owner` and stored the second writer's entire
|
|
682
|
+
* conversation — leaving the index naming one person and the stored
|
|
683
|
+
* conversation naming another. The person the index named listed it, opened
|
|
684
|
+
* it, and read the other one's conversation.
|
|
685
|
+
*
|
|
686
|
+
* A turn carrying a LEANER identity is not refused. It claims nobody, so it
|
|
687
|
+
* contradicts nobody, and the established owner stands — see `listByUser`.
|
|
688
|
+
*
|
|
689
|
+
* The composer refuses a foreign turn at the door long before this, when a
|
|
690
|
+
* verifier is configured. This is the store keeping the same promise for
|
|
691
|
+
* every caller that holds it directly, and for a door with no verifier.
|
|
692
|
+
*/
|
|
664
693
|
persist(sessionId: string, envelope: CheckpointEnvelope): Promise<void>;
|
|
665
694
|
/**
|
|
666
695
|
* Called once per served request, before `hydrate`, for stores that need to
|
|
@@ -688,9 +717,38 @@ export interface SessionLifecycle {
|
|
|
688
717
|
*
|
|
689
718
|
* **And established ONCE.** The first turn that signs for a conversation owns
|
|
690
719
|
* it; no later write moves that — not a leaner identity (which would erase
|
|
691
|
-
* it) and not a different one (which would transfer it).
|
|
692
|
-
*
|
|
693
|
-
* would undo every ownership check made against it one turn later.
|
|
720
|
+
* it) and not a different one (which would transfer it). Every shipped store
|
|
721
|
+
* implements the index that way, and a custom one that let the last writer
|
|
722
|
+
* win would undo every ownership check made against it one turn later.
|
|
723
|
+
*
|
|
724
|
+
* The two halves of "no later write moves it" are NOT symmetrical, and
|
|
725
|
+
* 9.36.1 exists because they were treated as if they were:
|
|
726
|
+
*
|
|
727
|
+
* - a **leaner** turn is stored, and the owner is kept. It claims nobody, so
|
|
728
|
+
* it contradicts nobody. Refusing it would break a flow this contract
|
|
729
|
+
* blesses in the sentence above.
|
|
730
|
+
* - a **different** turn is REFUSED — index and envelope both. Keeping the
|
|
731
|
+
* index while storing the payload is not "not moving" the owner; it is
|
|
732
|
+
* moving the CONVERSATION out from under them, which is worse. Don't
|
|
733
|
+
* write this rule yourself: `resolveSessionOwner(sessionId, stored,
|
|
734
|
+
* incoming)` is the one implementation, and it is what every shipped store
|
|
735
|
+
* now calls.
|
|
736
|
+
*
|
|
737
|
+
* ── Which of the two says who owns a session ────────────────────────────────
|
|
738
|
+
* This index is the authority for LISTING and for the session-history ops:
|
|
739
|
+
* `ownerOf` is the question `{ op: 'session-transcript' }` asks, and nothing
|
|
740
|
+
* re-derives an answer behind it. An ordinary TURN does not ask it — it
|
|
741
|
+
* re-derives from the envelope it has just hydrated (`envelopeOwner`), which
|
|
742
|
+
* is the same derivation and one round-trip cheaper, and which is what keeps
|
|
743
|
+
* a store with NO index protected exactly as well as one with a fast one.
|
|
744
|
+
*
|
|
745
|
+
* Those two can never name different people: that is what the refusal above
|
|
746
|
+
* buys, and it is the only reason a turn is safe to answer from the envelope.
|
|
747
|
+
* They CAN differ in one direction — an index that names somebody over a
|
|
748
|
+
* conversation that names nobody, which is what a leaner turn leaves behind.
|
|
749
|
+
* That state only ever REFUSES: the owner can still list and read the
|
|
750
|
+
* session, and a turn on it is refused at any verifying door, for everybody.
|
|
751
|
+
* Stated because it is a real asymmetry and not a bug to be surprised by.
|
|
694
752
|
*
|
|
695
753
|
* A conversation that ran anonymously has no owner and appears in nobody's
|
|
696
754
|
* list. That is the honest consequence of deriving rather than inventing.
|
|
@@ -707,6 +765,12 @@ export interface SessionLifecycle {
|
|
|
707
765
|
*
|
|
708
766
|
* Implement it beside `listByUser` — a door that can list but not check
|
|
709
767
|
* ownership can hand somebody a list and then refuse to open any of it.
|
|
768
|
+
*
|
|
769
|
+
* This is the ownership INDEX, and it is not a second source of truth beside
|
|
770
|
+
* the identity embedded in the stored envelope: `persist` refuses any write
|
|
771
|
+
* that would make the two name different people. A store that answers this
|
|
772
|
+
* from something a caller supplied, rather than from what it derived, has
|
|
773
|
+
* built a permission system out of a request field.
|
|
710
774
|
*/
|
|
711
775
|
ownerOf?(sessionId: string): Promise<string | undefined>;
|
|
712
776
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/hosting/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/hosting/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA29BH;iFACiF;AACjF,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC"}
|
|
@@ -151,6 +151,13 @@ export interface DefineSkillOptions {
|
|
|
151
151
|
* agent's registry at BUILD time and the model can see and call them
|
|
152
152
|
* from iteration 1, activated or not.
|
|
153
153
|
*
|
|
154
|
+
* Saying it once for the whole agent instead of once per skill:
|
|
155
|
+
* `.toolsFromActiveSkill()` on the builder (9.36.0) stamps this field on
|
|
156
|
+
* every tool-carrying skill, and `skillGraph({ scopeTools: true })` stamps it
|
|
157
|
+
* on the skills a graph wires. Both are DEFAULTS — a skill that declared its
|
|
158
|
+
* own keeps it — and since `'currentSkill'` is the only legal value, none of
|
|
159
|
+
* the three can contradict another.
|
|
160
|
+
*
|
|
154
161
|
* Wired at runtime since v2.5: `buildToolRegistry` holds these tools out of the
|
|
155
162
|
* static registry and `buildToolsSlot` readmits them per-iteration from the
|
|
156
163
|
* active injections. Dispatch is unaffected either way — an autoActivate tool
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineSkill.js","sourceRoot":"","sources":["../../../../../src/lib/injection-engine/factories/defineSkill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAExE,OAAO,EAAE,kBAAkB,EAAqC,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"defineSkill.js","sourceRoot":"","sources":["../../../../../src/lib/injection-engine/factories/defineSkill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAExE,OAAO,EAAE,kBAAkB,EAAqC,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAsOjE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAgB,EAAE,KAAc;IACjE,MAAM,CAAC,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IACjC,IAAI,CAAC,KAAK,WAAW,EAAE,CAAC;QACtB,2CAA2C;QAC3C,4CAA4C;QAC5C,+EAA+E;QAC/E,gFAA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CAAC,CAAC;gBACpE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAK,SAAmB;aAC5C,CAAC;YACJ,yEAAyE;YACzE,sEAAsE;YACtE,wEAAwE;YACxE,iEAAiE;YACjE,GAAG,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YACnF,GAAG,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YACnF,KAAK,EAAE,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC;SAC/C,CAAC;KACH,CAAyB,CAAC;AAC7B,CAAC"}
|
|
@@ -29,21 +29,56 @@
|
|
|
29
29
|
* body (what it reads after deciding). That is the same file convention Claude
|
|
30
30
|
* Code made familiar, so a skill folder is portable between the two.
|
|
31
31
|
*
|
|
32
|
-
* ── What a SKILL.md can
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
32
|
+
* ── What a SKILL.md can carry (9.36.0: the whole runbook) ────────────────────
|
|
33
|
+
* A runbook you already have on disk is three things — what to do (prose),
|
|
34
|
+
* what to do it WITH (tools), and in what order (steps). This door used to
|
|
35
|
+
* carry the first and drop the other two, so the one thing the library exists
|
|
36
|
+
* to say ("extract the workflow you already have") arrived two-thirds empty.
|
|
37
|
+
* All three now cross:
|
|
38
|
+
*
|
|
39
|
+
* ---
|
|
40
|
+
* name: billing
|
|
41
|
+
* description: Use for refunds, charges and billing questions.
|
|
42
|
+
* tools: lookup_order, issue_refund
|
|
43
|
+
* steps:
|
|
44
|
+
* - lookup_order: look up the order before touching money
|
|
45
|
+
* - issue_refund: refund only what the lookup found
|
|
46
|
+
* onSkip: hold
|
|
47
|
+
* ---
|
|
48
|
+
* When handling billing: confirm identity first, then …
|
|
49
|
+
*
|
|
50
|
+
* const skills = await skillsFromDir('./skills', {
|
|
51
|
+
* tools: [lookupOrder, issueRefund], // the real Tools, from YOUR code
|
|
52
|
+
* });
|
|
53
|
+
*
|
|
54
|
+
* The remaining limits, and why each one is a decision rather than an
|
|
55
|
+
* oversight:
|
|
56
|
+
*
|
|
57
|
+
* - **the file names a tool; it never defines one.** A tool is code with an
|
|
58
|
+
* `execute`, and a markdown file has none. `tools:` is a list of NAMES,
|
|
59
|
+
* resolved against the `tools` registry the CALLER passes — so the file
|
|
60
|
+
* can only ever pick from capabilities you already handed in, and reading a
|
|
61
|
+
* directory can never introduce one. See "why this is not a code-execution
|
|
62
|
+
* vector" below.
|
|
63
|
+
* - **a name the registry does not carry is refused BY NAME at load** —
|
|
64
|
+
* never a skill that quietly loads without the tool it asked for, because
|
|
65
|
+
* that skill runs, sounds confident, and cannot do the job.
|
|
66
|
+
* - **no per-step `produces` / `consumes`** — the artifact vocabularies
|
|
67
|
+
* (9.25.0) are a build-time contract between skills, not runbook prose;
|
|
68
|
+
* declare them with `defineSkill` where the rest of the agent is declared.
|
|
69
|
+
* - **no `autoActivate`** — a directory does not decide the agent's tool
|
|
70
|
+
* posture. Say it once on the agent with `.toolsFromActiveSkill()`
|
|
71
|
+
* (9.36.0), which scopes every skill's tools to that skill's activation.
|
|
72
|
+
* Without it, a loaded skill's tools are on the wire from iteration 1, the
|
|
73
|
+
* same as any hand-written `defineSkill({ tools })`.
|
|
74
|
+
* - **no per-file `surfaceMode`, `cache` or `refreshPolicy`** — `surfaceMode`
|
|
75
|
+
* is settable for the WHOLE directory via `opts`, all of them or none; the
|
|
76
|
+
* others take `defineSkill`'s defaults.
|
|
77
|
+
* - unknown frontmatter keys are still IGNORED, not rejected, so a file
|
|
78
|
+
* carrying another tool's metadata still loads here. `name`,
|
|
79
|
+
* `description`, `tools`, `steps` and `onSkip` are the KNOWN keys — a file
|
|
80
|
+
* that used one of those five for something else is the one case this
|
|
81
|
+
* release can change, and it changes it loudly.
|
|
47
82
|
*
|
|
48
83
|
* A worked example feeding this into a graph:
|
|
49
84
|
* `examples/features/47-skills-from-dir-graph.ts`.
|
|
@@ -57,12 +92,24 @@
|
|
|
57
92
|
* only make about a path on your own disk at build time. Each file is read
|
|
58
93
|
* ONCE, here; a later edit does not reach a run already in flight.
|
|
59
94
|
*
|
|
95
|
+
* ── Why carrying tools is not a code-execution vector ───────────────────────
|
|
96
|
+
* Nothing in a SKILL.md is evaluated, imported, required or resolved as a
|
|
97
|
+
* path. `tools:` is a list of strings, and the only thing a string can do here
|
|
98
|
+
* is MATCH — against `tool.schema.name` in a registry the caller constructed in
|
|
99
|
+
* their own source, from their own imports. A hostile file can therefore ask
|
|
100
|
+
* for a tool you already gave the agent (and it would have to guess the name);
|
|
101
|
+
* it can never name a module, widen the agent's capabilities, or cause one byte
|
|
102
|
+
* of new code to run. The set of things this directory can do is a SUBSET of
|
|
103
|
+
* what the calling file already decided to do, which is the same property the
|
|
104
|
+
* local-path rule above buys for bodies.
|
|
105
|
+
*
|
|
60
106
|
* Node-only. `node:fs/promises` and `node:path` are imported lazily inside the
|
|
61
107
|
* call, the same gating `lib/tool-lint/cli.ts` uses: this module is reachable
|
|
62
108
|
* from the `agentfootprint/context` barrel, and a TOP-LEVEL node:fs
|
|
63
109
|
* import detonates a browser bundle at module-eval even when nothing calls it.
|
|
64
110
|
*/
|
|
65
111
|
import type { Injection } from './types.js';
|
|
112
|
+
import type { Tool } from '../../core/tools.js';
|
|
66
113
|
import { type SurfaceMode } from './factories/defineSkill.js';
|
|
67
114
|
export interface SkillsFromDirOptions {
|
|
68
115
|
/**
|
|
@@ -70,6 +117,21 @@ export interface SkillsFromDirOptions {
|
|
|
70
117
|
* `defineSkill`'s own default, `'auto'`. See {@link SurfaceMode}.
|
|
71
118
|
*/
|
|
72
119
|
readonly surfaceMode?: SurfaceMode;
|
|
120
|
+
/**
|
|
121
|
+
* The tools a file may NAME (9.36.0) — the resolution registry for every
|
|
122
|
+
* `tools:` declaration in the directory, matched by `tool.schema.name`.
|
|
123
|
+
*
|
|
124
|
+
* This is the half a markdown file cannot supply. The file picks; you decide
|
|
125
|
+
* what there is to pick FROM, in your own source, from your own imports. A
|
|
126
|
+
* declared name that is not in here is refused at load, naming the file, the
|
|
127
|
+
* name, and what this registry does carry.
|
|
128
|
+
*
|
|
129
|
+
* Pass every tool the directory might use; a tool nothing names is simply
|
|
130
|
+
* unused (no skill gets it, and no error). Omit the option entirely on a
|
|
131
|
+
* prose-only directory — a file that declares `tools:` with no registry
|
|
132
|
+
* passed is refused rather than loaded without them.
|
|
133
|
+
*/
|
|
134
|
+
readonly tools?: readonly Tool[];
|
|
73
135
|
}
|
|
74
136
|
/**
|
|
75
137
|
* Load every `SKILL.md` under `dir` as a Skill Injection.
|
|
@@ -88,7 +150,8 @@ export interface SkillsFromDirOptions {
|
|
|
88
150
|
*
|
|
89
151
|
* @throws when `dir` is not a local path, does not exist, is not a directory,
|
|
90
152
|
* or contains no `SKILL.md` at all; when a file's frontmatter is malformed
|
|
91
|
-
* (the message names the file);
|
|
92
|
-
* (the message names both)
|
|
153
|
+
* (the message names the file); when two files claim the same skill name
|
|
154
|
+
* (the message names both); or when a file names a tool the `tools` registry
|
|
155
|
+
* does not carry, or sequences a tool the file itself did not declare.
|
|
93
156
|
*/
|
|
94
157
|
export declare function skillsFromDir(dir: string, opts?: SkillsFromDirOptions): Promise<readonly Injection[]>;
|