@agent-deck/backend 1.8.2 → 1.10.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/.tsbuildinfo +1 -1
- package/dist/cli-runtime.d.ts.map +1 -1
- package/dist/cli-runtime.js +5 -5
- package/dist/cli-runtime.js.map +1 -1
- package/dist/config/mcp-endpoint.d.ts +6 -0
- package/dist/config/mcp-endpoint.d.ts.map +1 -0
- package/dist/config/mcp-endpoint.js +19 -0
- package/dist/config/mcp-endpoint.js.map +1 -0
- package/dist/export-import/import-bundle.d.ts +12 -1
- package/dist/export-import/import-bundle.d.ts.map +1 -1
- package/dist/export-import/import-bundle.js +11 -3
- package/dist/export-import/import-bundle.js.map +1 -1
- package/dist/mcp-server.d.ts +50 -0
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +205 -22
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp-tools/test-harness.d.ts +17 -0
- package/dist/mcp-tools/test-harness.d.ts.map +1 -1
- package/dist/mcp-tools/test-harness.js +49 -2
- package/dist/mcp-tools/test-harness.js.map +1 -1
- package/dist/models/database.d.ts +2 -0
- package/dist/models/database.d.ts.map +1 -1
- package/dist/models/database.js +16 -0
- package/dist/models/database.js.map +1 -1
- package/dist/playbooks/playbook-manager.d.ts.map +1 -1
- package/dist/playbooks/playbook-manager.js +9 -4
- package/dist/playbooks/playbook-manager.js.map +1 -1
- package/dist/routes/decks.d.ts.map +1 -1
- package/dist/routes/decks.js +8 -51
- package/dist/routes/decks.js.map +1 -1
- package/dist/routes/export-import.d.ts.map +1 -1
- package/dist/routes/export-import.js +3 -5
- package/dist/routes/export-import.js.map +1 -1
- package/dist/services/service-manager.d.ts +5 -1
- package/dist/services/service-manager.d.ts.map +1 -1
- package/dist/services/service-manager.js +27 -3
- package/dist/services/service-manager.js.map +1 -1
- package/dist/store/deck-file.d.ts +55 -0
- package/dist/store/deck-file.d.ts.map +1 -0
- package/dist/store/deck-file.js +163 -0
- package/dist/store/deck-file.js.map +1 -0
- package/dist/store/index.d.ts +1 -0
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +1 -0
- package/dist/store/index.js.map +1 -1
- package/dist/store/migrate.d.ts.map +1 -1
- package/dist/store/migrate.js +2 -12
- package/dist/store/migrate.js.map +1 -1
- package/dist/vault/credential-manager.d.ts +6 -2
- package/dist/vault/credential-manager.d.ts.map +1 -1
- package/dist/vault/credential-manager.js +21 -14
- package/dist/vault/credential-manager.js.map +1 -1
- package/package.json +2 -2
- package/dist/execution-authority/bearer.d.ts +0 -15
- package/dist/execution-authority/bearer.d.ts.map +0 -1
- package/dist/execution-authority/bearer.js +0 -35
- package/dist/execution-authority/bearer.js.map +0 -1
- package/dist/execution-authority/index.d.ts +0 -6
- package/dist/execution-authority/index.d.ts.map +0 -1
- package/dist/execution-authority/index.js +0 -8
- package/dist/execution-authority/index.js.map +0 -1
- package/dist/execution-authority/ledger.d.ts +0 -85
- package/dist/execution-authority/ledger.d.ts.map +0 -1
- package/dist/execution-authority/ledger.js +0 -507
- package/dist/execution-authority/ledger.js.map +0 -1
- package/dist/execution-authority/store.d.ts +0 -55
- package/dist/execution-authority/store.d.ts.map +0 -1
- package/dist/execution-authority/store.js +0 -256
- package/dist/execution-authority/store.js.map +0 -1
- package/dist/execution-authority/types.d.ts +0 -119
- package/dist/execution-authority/types.d.ts.map +0 -1
- package/dist/execution-authority/types.js +0 -9
- package/dist/execution-authority/types.js.map +0 -1
- package/dist/lib/execution-authority-http.d.ts +0 -23
- package/dist/lib/execution-authority-http.d.ts.map +0 -1
- package/dist/lib/execution-authority-http.js +0 -101
- package/dist/lib/execution-authority-http.js.map +0 -1
- package/dist/mcp-stdio.d.ts +0 -2
- package/dist/mcp-stdio.d.ts.map +0 -1
- package/dist/mcp-stdio.js.map +0 -1
- package/dist/playbooks/playbook-parser.d.ts +0 -8
- package/dist/playbooks/playbook-parser.d.ts.map +0 -1
- package/dist/playbooks/playbook-parser.js +0 -76
- package/dist/playbooks/playbook-parser.js.map +0 -1
- package/dist/playbooks/playbook-service.d.ts +0 -9
- package/dist/playbooks/playbook-service.d.ts.map +0 -1
- package/dist/playbooks/playbook-service.js +0 -107
- package/dist/playbooks/playbook-service.js.map +0 -1
- package/dist/routes/execution-authority.d.ts +0 -8
- package/dist/routes/execution-authority.d.ts.map +0 -1
- package/dist/routes/execution-authority.js +0 -498
- package/dist/routes/execution-authority.js.map +0 -1
- package/dist/scope/bindings-sidecar.d.ts +0 -9
- package/dist/scope/bindings-sidecar.d.ts.map +0 -1
- package/dist/scope/bindings-sidecar.js +0 -57
- package/dist/scope/bindings-sidecar.js.map +0 -1
- package/dist/scope/repo-deck.d.ts +0 -10
- package/dist/scope/repo-deck.d.ts.map +0 -1
- package/dist/scope/repo-deck.js +0 -63
- package/dist/scope/repo-deck.js.map +0 -1
- package/dist/test-local-mcp-e2e.d.ts +0 -3
- package/dist/test-local-mcp-e2e.d.ts.map +0 -1
- package/dist/test-local-mcp-e2e.js +0 -104
- package/dist/test-local-mcp-e2e.js.map +0 -1
- package/static-ui/favicon.png +0 -0
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Durable SQLite-backed execution-authority store (NOT-86).
|
|
4
|
-
* Logic lives in ExecutionAuthorityLedger; this module hydrates/persists snapshots.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ExecutionAuthorityStore = void 0;
|
|
8
|
-
const ledger_1 = require("./ledger");
|
|
9
|
-
class ExecutionAuthorityStore {
|
|
10
|
-
db;
|
|
11
|
-
ledger;
|
|
12
|
-
constructor(db, options = {}) {
|
|
13
|
-
this.db = db;
|
|
14
|
-
this.ensureTables();
|
|
15
|
-
this.ledger = new ledger_1.ExecutionAuthorityLedger({ now: options.now });
|
|
16
|
-
this.hydrate();
|
|
17
|
-
}
|
|
18
|
-
/** Test helper: replace clock without losing durable state. */
|
|
19
|
-
withNow(now) {
|
|
20
|
-
const next = new ExecutionAuthorityStore(this.db, { now });
|
|
21
|
-
return next;
|
|
22
|
-
}
|
|
23
|
-
ensureTables() {
|
|
24
|
-
this.db.exec(`
|
|
25
|
-
CREATE TABLE IF NOT EXISTS ea_enrollments (
|
|
26
|
-
enrollment_id TEXT PRIMARY KEY,
|
|
27
|
-
coordinator_id TEXT NOT NULL,
|
|
28
|
-
status TEXT NOT NULL CHECK (status IN ('active', 'revoked')),
|
|
29
|
-
allowed_deck_ids TEXT NOT NULL,
|
|
30
|
-
created_at TEXT NOT NULL,
|
|
31
|
-
revoked_at TEXT,
|
|
32
|
-
secret_hash TEXT NOT NULL
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
CREATE TABLE IF NOT EXISTS ea_authorities (
|
|
36
|
-
authority_id TEXT PRIMARY KEY,
|
|
37
|
-
enrollment_id TEXT NOT NULL,
|
|
38
|
-
run_id TEXT NOT NULL,
|
|
39
|
-
attempt_id TEXT NOT NULL,
|
|
40
|
-
deck_id TEXT NOT NULL,
|
|
41
|
-
audience TEXT NOT NULL,
|
|
42
|
-
allowed_services TEXT NOT NULL,
|
|
43
|
-
allowed_tools TEXT NOT NULL,
|
|
44
|
-
issued_at TEXT NOT NULL,
|
|
45
|
-
expires_at TEXT NOT NULL,
|
|
46
|
-
status TEXT NOT NULL CHECK (status IN ('live', 'expired', 'revoked')),
|
|
47
|
-
idempotency_key TEXT NOT NULL,
|
|
48
|
-
secret_hash TEXT NOT NULL,
|
|
49
|
-
FOREIGN KEY (enrollment_id) REFERENCES ea_enrollments (enrollment_id)
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
CREATE UNIQUE INDEX IF NOT EXISTS ea_authorities_mint_idempotency
|
|
53
|
-
ON ea_authorities (enrollment_id, idempotency_key);
|
|
54
|
-
|
|
55
|
-
CREATE TABLE IF NOT EXISTS ea_audit_events (
|
|
56
|
-
event_id TEXT PRIMARY KEY,
|
|
57
|
-
at TEXT NOT NULL,
|
|
58
|
-
kind TEXT NOT NULL,
|
|
59
|
-
correlation_json TEXT NOT NULL,
|
|
60
|
-
detail_json TEXT
|
|
61
|
-
);
|
|
62
|
-
`);
|
|
63
|
-
}
|
|
64
|
-
hydrate() {
|
|
65
|
-
const enrollments = this.db
|
|
66
|
-
.prepare(`SELECT enrollment_id, coordinator_id, status, allowed_deck_ids, created_at, revoked_at, secret_hash
|
|
67
|
-
FROM ea_enrollments`)
|
|
68
|
-
.all();
|
|
69
|
-
const authorities = this.db
|
|
70
|
-
.prepare(`SELECT authority_id, enrollment_id, run_id, attempt_id, deck_id, audience,
|
|
71
|
-
allowed_services, allowed_tools, issued_at, expires_at, status, idempotency_key, secret_hash
|
|
72
|
-
FROM ea_authorities`)
|
|
73
|
-
.all();
|
|
74
|
-
const audit = this.db
|
|
75
|
-
.prepare(`SELECT event_id, at, kind, correlation_json, detail_json FROM ea_audit_events ORDER BY at ASC, event_id ASC`)
|
|
76
|
-
.all();
|
|
77
|
-
const state = {
|
|
78
|
-
enrollments: enrollments.map((row) => ({
|
|
79
|
-
enrollmentId: row.enrollment_id,
|
|
80
|
-
coordinatorId: row.coordinator_id,
|
|
81
|
-
status: row.status,
|
|
82
|
-
allowedDeckIds: JSON.parse(row.allowed_deck_ids),
|
|
83
|
-
createdAt: row.created_at,
|
|
84
|
-
revokedAt: row.revoked_at,
|
|
85
|
-
})),
|
|
86
|
-
enrollmentSecretHashes: enrollments.map((row) => ({
|
|
87
|
-
enrollmentId: row.enrollment_id,
|
|
88
|
-
secretHash: row.secret_hash,
|
|
89
|
-
})),
|
|
90
|
-
authorities: authorities.map((row) => ({
|
|
91
|
-
authorityId: row.authority_id,
|
|
92
|
-
enrollmentId: row.enrollment_id,
|
|
93
|
-
runId: row.run_id,
|
|
94
|
-
attemptId: row.attempt_id,
|
|
95
|
-
deckId: row.deck_id,
|
|
96
|
-
audience: row.audience,
|
|
97
|
-
allowedServices: JSON.parse(row.allowed_services),
|
|
98
|
-
allowedTools: JSON.parse(row.allowed_tools),
|
|
99
|
-
issuedAt: row.issued_at,
|
|
100
|
-
expiresAt: row.expires_at,
|
|
101
|
-
status: row.status,
|
|
102
|
-
idempotencyKey: row.idempotency_key,
|
|
103
|
-
})),
|
|
104
|
-
secretHashes: authorities.map((row) => ({
|
|
105
|
-
authorityId: row.authority_id,
|
|
106
|
-
secretHash: row.secret_hash,
|
|
107
|
-
})),
|
|
108
|
-
mintIndex: authorities.map((row) => ({
|
|
109
|
-
enrollmentId: row.enrollment_id,
|
|
110
|
-
idempotencyKey: row.idempotency_key,
|
|
111
|
-
authorityId: row.authority_id,
|
|
112
|
-
})),
|
|
113
|
-
audit: audit.map((row) => ({
|
|
114
|
-
eventId: row.event_id,
|
|
115
|
-
at: row.at,
|
|
116
|
-
kind: row.kind,
|
|
117
|
-
correlation: JSON.parse(row.correlation_json),
|
|
118
|
-
detail: row.detail_json
|
|
119
|
-
? JSON.parse(row.detail_json)
|
|
120
|
-
: undefined,
|
|
121
|
-
})),
|
|
122
|
-
};
|
|
123
|
-
this.ledger.replaceState(state);
|
|
124
|
-
}
|
|
125
|
-
persist() {
|
|
126
|
-
const state = this.ledger.exportState();
|
|
127
|
-
const tx = this.db.transaction(() => {
|
|
128
|
-
this.db.exec(`
|
|
129
|
-
DELETE FROM ea_audit_events;
|
|
130
|
-
DELETE FROM ea_authorities;
|
|
131
|
-
DELETE FROM ea_enrollments;
|
|
132
|
-
`);
|
|
133
|
-
const insertEnrollment = this.db.prepare(`INSERT INTO ea_enrollments
|
|
134
|
-
(enrollment_id, coordinator_id, status, allowed_deck_ids, created_at, revoked_at, secret_hash)
|
|
135
|
-
VALUES (?, ?, ?, ?, ?, ?, ?)`);
|
|
136
|
-
const hashByEnrollment = new Map(state.enrollmentSecretHashes.map((r) => [r.enrollmentId, r.secretHash]));
|
|
137
|
-
for (const enrollment of state.enrollments) {
|
|
138
|
-
const secretHash = hashByEnrollment.get(enrollment.enrollmentId);
|
|
139
|
-
if (!secretHash) {
|
|
140
|
-
throw new Error(`Missing enrollment secret hash for ${enrollment.enrollmentId}`);
|
|
141
|
-
}
|
|
142
|
-
insertEnrollment.run(enrollment.enrollmentId, enrollment.coordinatorId, enrollment.status, JSON.stringify(enrollment.allowedDeckIds), enrollment.createdAt, enrollment.revokedAt, secretHash);
|
|
143
|
-
}
|
|
144
|
-
const insertAuthority = this.db.prepare(`INSERT INTO ea_authorities
|
|
145
|
-
(authority_id, enrollment_id, run_id, attempt_id, deck_id, audience,
|
|
146
|
-
allowed_services, allowed_tools, issued_at, expires_at, status, idempotency_key, secret_hash)
|
|
147
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
148
|
-
const hashByAuthority = new Map(state.secretHashes.map((r) => [r.authorityId, r.secretHash]));
|
|
149
|
-
for (const authority of state.authorities) {
|
|
150
|
-
const secretHash = hashByAuthority.get(authority.authorityId);
|
|
151
|
-
if (!secretHash) {
|
|
152
|
-
throw new Error(`Missing authority secret hash for ${authority.authorityId}`);
|
|
153
|
-
}
|
|
154
|
-
insertAuthority.run(authority.authorityId, authority.enrollmentId, authority.runId, authority.attemptId, authority.deckId, authority.audience, JSON.stringify(authority.allowedServices), JSON.stringify(authority.allowedTools), authority.issuedAt, authority.expiresAt, authority.status, authority.idempotencyKey, secretHash);
|
|
155
|
-
}
|
|
156
|
-
const insertAudit = this.db.prepare(`INSERT INTO ea_audit_events (event_id, at, kind, correlation_json, detail_json)
|
|
157
|
-
VALUES (?, ?, ?, ?, ?)`);
|
|
158
|
-
for (const event of state.audit) {
|
|
159
|
-
insertAudit.run(event.eventId, event.at, event.kind, JSON.stringify(event.correlation), event.detail ? JSON.stringify(event.detail) : null);
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
tx();
|
|
163
|
-
}
|
|
164
|
-
runMutating(fn) {
|
|
165
|
-
const result = fn();
|
|
166
|
-
this.persist();
|
|
167
|
-
return result;
|
|
168
|
-
}
|
|
169
|
-
enrollCoordinator(input) {
|
|
170
|
-
return this.runMutating(() => this.ledger.enrollCoordinator(input));
|
|
171
|
-
}
|
|
172
|
-
revokeEnrollment(enrollmentId) {
|
|
173
|
-
return this.runMutating(() => this.ledger.revokeEnrollment(enrollmentId));
|
|
174
|
-
}
|
|
175
|
-
mintAuthority(input) {
|
|
176
|
-
return this.runMutating(() => this.ledger.mintAuthority(input));
|
|
177
|
-
}
|
|
178
|
-
/** Non-auditing existence/ownership lookup (see ledger.peekAuthority). */
|
|
179
|
-
peekAuthority(authorityId) {
|
|
180
|
-
return this.ledger.peekAuthority(authorityId);
|
|
181
|
-
}
|
|
182
|
-
inspectAuthority(authorityId) {
|
|
183
|
-
return this.runMutating(() => this.ledger.inspectAuthority(authorityId));
|
|
184
|
-
}
|
|
185
|
-
revokeAuthority(authorityId) {
|
|
186
|
-
return this.runMutating(() => this.ledger.revokeAuthority(authorityId));
|
|
187
|
-
}
|
|
188
|
-
invokeAuthorizedCall(input) {
|
|
189
|
-
return this.runMutating(() => this.ledger.invokeAuthorizedCall(input));
|
|
190
|
-
}
|
|
191
|
-
listAuditEvents(filter = {}) {
|
|
192
|
-
return this.ledger.listAuditEvents(filter);
|
|
193
|
-
}
|
|
194
|
-
getEnrollment(enrollmentId) {
|
|
195
|
-
return this.ledger.getEnrollment(enrollmentId);
|
|
196
|
-
}
|
|
197
|
-
listEnrollments() {
|
|
198
|
-
return this.ledger.listEnrollments();
|
|
199
|
-
}
|
|
200
|
-
verifyEnrollmentSecret(enrollmentId, secret) {
|
|
201
|
-
return this.ledger.verifyEnrollmentSecret(enrollmentId, secret);
|
|
202
|
-
}
|
|
203
|
-
verifyAuthoritySecret(authorityId, secret) {
|
|
204
|
-
return this.ledger.verifyAuthoritySecret(authorityId, secret);
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Validate authority id+secret and return current authority (may transition to expired).
|
|
208
|
-
*/
|
|
209
|
-
authenticateAuthority(authorityId, authoritySecret) {
|
|
210
|
-
const inspected = this.ledger.inspectAuthority(authorityId);
|
|
211
|
-
this.persist();
|
|
212
|
-
if (!inspected.ok) {
|
|
213
|
-
return inspected;
|
|
214
|
-
}
|
|
215
|
-
if (!this.ledger.verifyAuthoritySecret(authorityId, authoritySecret)) {
|
|
216
|
-
return {
|
|
217
|
-
ok: false,
|
|
218
|
-
error_code: 'AUTHORITY_SECRET_INVALID',
|
|
219
|
-
message: 'Invalid authority secret',
|
|
220
|
-
correlation: { authorityId },
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
if (inspected.data.status === 'expired') {
|
|
224
|
-
return {
|
|
225
|
-
ok: false,
|
|
226
|
-
error_code: 'AUTHORITY_EXPIRED',
|
|
227
|
-
message: 'Authority expired',
|
|
228
|
-
correlation: {
|
|
229
|
-
authorityId,
|
|
230
|
-
enrollmentId: inspected.data.enrollmentId,
|
|
231
|
-
runId: inspected.data.runId,
|
|
232
|
-
attemptId: inspected.data.attemptId,
|
|
233
|
-
deckId: inspected.data.deckId,
|
|
234
|
-
},
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
if (inspected.data.status === 'revoked') {
|
|
238
|
-
return {
|
|
239
|
-
ok: false,
|
|
240
|
-
error_code: 'AUTHORITY_REVOKED',
|
|
241
|
-
message: 'Authority revoked',
|
|
242
|
-
reason: 'explicit_revoke',
|
|
243
|
-
correlation: {
|
|
244
|
-
authorityId,
|
|
245
|
-
enrollmentId: inspected.data.enrollmentId,
|
|
246
|
-
runId: inspected.data.runId,
|
|
247
|
-
attemptId: inspected.data.attemptId,
|
|
248
|
-
deckId: inspected.data.deckId,
|
|
249
|
-
},
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
return inspected;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
exports.ExecutionAuthorityStore = ExecutionAuthorityStore;
|
|
256
|
-
//# sourceMappingURL=store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src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
2
|
-
* Trusted unattended execution contract types (NOT-85).
|
|
3
|
-
* Authoritative design: docs/superpowers/specs/2026-09-12-trusted-unattended-execution-contract-design.md
|
|
4
|
-
*
|
|
5
|
-
* Interactive workspace grants remain separate (PRD_TRUSTED_AGENT_SESSIONS).
|
|
6
|
-
*/
|
|
7
|
-
export type EnrollmentStatus = 'active' | 'revoked';
|
|
8
|
-
export type AuthorityStatus = 'live' | 'expired' | 'revoked';
|
|
9
|
-
export type AuthorityAudience = 'dealer-worker';
|
|
10
|
-
export type ContractErrorCode = 'GRANT_REQUIRED' | 'AUTHORITY_EXPIRED' | 'AUTHORITY_REVOKED' | 'AUTHORITY_UNKNOWN' | 'AUTHORITY_SECRET_INVALID' | 'RESOURCE_OUT_OF_SCOPE' | 'INTERACTION_REQUIRED' | 'ENROLLMENT_REVOKED' | 'COORDINATOR_NOT_ENROLLED' | 'IDEMPOTENCY_KEY_CONFLICT' | 'INVALID_MINT_REQUEST' | 'AUDIENCE_MISMATCH';
|
|
11
|
-
/** Fine-grained cause when one error_code covers multiple recovery paths. */
|
|
12
|
-
export type ContractErrorReason = 'deck_not_permitted' | 'deck_not_found' | 'tool_not_in_snapshot' | 'enrollment_revoked' | 'explicit_revoke' | 'params_mismatch' | 'ttl_non_positive';
|
|
13
|
-
export type AuditEventKind = 'enrollment_created' | 'enrollment_revoked' | 'authority_minted' | 'authority_inspected' | 'authority_revoked' | 'authority_expired' | 'call_allowed' | 'call_denied';
|
|
14
|
-
export interface AllowedTool {
|
|
15
|
-
serviceId: string;
|
|
16
|
-
toolName: string;
|
|
17
|
-
}
|
|
18
|
-
export interface CoordinatorEnrollment {
|
|
19
|
-
enrollmentId: string;
|
|
20
|
-
coordinatorId: string;
|
|
21
|
-
status: EnrollmentStatus;
|
|
22
|
-
allowedDeckIds: string[];
|
|
23
|
-
createdAt: string;
|
|
24
|
-
revokedAt: string | null;
|
|
25
|
-
}
|
|
26
|
-
export interface ExecutionAuthority {
|
|
27
|
-
authorityId: string;
|
|
28
|
-
enrollmentId: string;
|
|
29
|
-
runId: string;
|
|
30
|
-
attemptId: string;
|
|
31
|
-
deckId: string;
|
|
32
|
-
audience: AuthorityAudience;
|
|
33
|
-
allowedServices: string[];
|
|
34
|
-
allowedTools: AllowedTool[];
|
|
35
|
-
issuedAt: string;
|
|
36
|
-
expiresAt: string;
|
|
37
|
-
status: AuthorityStatus;
|
|
38
|
-
idempotencyKey: string;
|
|
39
|
-
}
|
|
40
|
-
export interface AuditCorrelation {
|
|
41
|
-
enrollmentId?: string;
|
|
42
|
-
authorityId?: string;
|
|
43
|
-
runId?: string;
|
|
44
|
-
attemptId?: string;
|
|
45
|
-
deckId?: string;
|
|
46
|
-
requestId?: string;
|
|
47
|
-
}
|
|
48
|
-
export interface AuditEvent {
|
|
49
|
-
eventId: string;
|
|
50
|
-
at: string;
|
|
51
|
-
kind: AuditEventKind;
|
|
52
|
-
correlation: AuditCorrelation;
|
|
53
|
-
detail?: Record<string, unknown>;
|
|
54
|
-
}
|
|
55
|
-
export interface ContractError {
|
|
56
|
-
ok: false;
|
|
57
|
-
error_code: ContractErrorCode;
|
|
58
|
-
message: string;
|
|
59
|
-
reason?: ContractErrorReason;
|
|
60
|
-
correlation?: AuditCorrelation;
|
|
61
|
-
}
|
|
62
|
-
export interface ContractSuccess<T> {
|
|
63
|
-
ok: true;
|
|
64
|
-
data: T;
|
|
65
|
-
}
|
|
66
|
-
export type ContractResult<T> = ContractSuccess<T> | ContractError;
|
|
67
|
-
export interface EnrollCoordinatorResult {
|
|
68
|
-
enrollment: CoordinatorEnrollment;
|
|
69
|
-
/** One-time secret for coordinator mint/metadata auth (`enrs_…`). */
|
|
70
|
-
enrollmentSecret: string;
|
|
71
|
-
}
|
|
72
|
-
export interface MintAuthorityInput {
|
|
73
|
-
enrollmentId: string;
|
|
74
|
-
runId: string;
|
|
75
|
-
attemptId: string;
|
|
76
|
-
deckId: string;
|
|
77
|
-
audience: AuthorityAudience;
|
|
78
|
-
idempotencyKey: string;
|
|
79
|
-
/**
|
|
80
|
-
* Pre-materialized Deck policy snapshot.
|
|
81
|
-
* HTTP mint authors these from deck policy; optional toolScopeHint may only narrow.
|
|
82
|
-
*/
|
|
83
|
-
allowedServices: string[];
|
|
84
|
-
allowedTools: AllowedTool[];
|
|
85
|
-
/** TTL in milliseconds from mint time; must be > 0. */
|
|
86
|
-
ttlMs: number;
|
|
87
|
-
}
|
|
88
|
-
/** Coordinator-supplied mint body before Deck authors the tool snapshot. */
|
|
89
|
-
export interface MintAuthorityRequest {
|
|
90
|
-
enrollmentId: string;
|
|
91
|
-
runId: string;
|
|
92
|
-
attemptId: string;
|
|
93
|
-
deckId: string;
|
|
94
|
-
audience: AuthorityAudience;
|
|
95
|
-
idempotencyKey: string;
|
|
96
|
-
ttlMs: number;
|
|
97
|
-
/** Optional narrowing hint; Deck intersects with current deck policy. */
|
|
98
|
-
toolScopeHint?: AllowedTool[];
|
|
99
|
-
}
|
|
100
|
-
export interface MintAuthorityResult {
|
|
101
|
-
authority: ExecutionAuthority;
|
|
102
|
-
/**
|
|
103
|
-
* One-time secret when `secretIssued` is true.
|
|
104
|
-
* Null on idempotent remint — Dealer must retain the launcher handle from first mint.
|
|
105
|
-
*/
|
|
106
|
-
authoritySecret: string | null;
|
|
107
|
-
secretIssued: boolean;
|
|
108
|
-
}
|
|
109
|
-
export interface AuthorizedCallInput {
|
|
110
|
-
authorityId: string;
|
|
111
|
-
authoritySecret: string;
|
|
112
|
-
/** Must match the authority's audience (stolen-authority binding). */
|
|
113
|
-
audience: string;
|
|
114
|
-
serviceId: string;
|
|
115
|
-
toolName: string;
|
|
116
|
-
/** When true, Deck returns INTERACTION_REQUIRED instead of executing. */
|
|
117
|
-
requiresInteraction?: boolean;
|
|
118
|
-
}
|
|
119
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/execution-authority/types.ts"],"names":[],"mappings":"AAA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AAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,4EAA4E;AAC5E,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,kBAAkB,CAAC;IAC9B;;;OAGG;IACH,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Trusted unattended execution contract types (NOT-85).
|
|
4
|
-
* Authoritative design: docs/superpowers/specs/2026-09-12-trusted-unattended-execution-contract-design.md
|
|
5
|
-
*
|
|
6
|
-
* Interactive workspace grants remain separate (PRD_TRUSTED_AGENT_SESSIONS).
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/execution-authority/types.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { FastifyReply, FastifyRequest } from 'fastify';
|
|
2
|
-
import type { ContractError } from '../execution-authority/types';
|
|
3
|
-
import type { ExecutionAuthorityStore } from '../execution-authority/store';
|
|
4
|
-
export declare function isExecutionAuthorityHttpAllowed(method: string, pathname: string): boolean;
|
|
5
|
-
/** Contract-shaped auth/containment failure for execution-authority principals. */
|
|
6
|
-
export declare class AuthorityContractAuthError extends Error {
|
|
7
|
-
readonly contract: ContractError;
|
|
8
|
-
constructor(contract: ContractError);
|
|
9
|
-
}
|
|
10
|
-
export declare function statusForContract(error: ContractError): number;
|
|
11
|
-
export declare function sendContractError(reply: FastifyReply, error: ContractError, status?: number): FastifyReply<import("fastify").RouteGenericInterface, import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown>;
|
|
12
|
-
/**
|
|
13
|
-
* Authorize one service tool call via the ledger (audience + audit).
|
|
14
|
-
* No-op for non-authority principals.
|
|
15
|
-
*/
|
|
16
|
-
export declare function authorizeAuthorityServiceCall(request: FastifyRequest, store: ExecutionAuthorityStore, serviceId: string, toolName: string): void;
|
|
17
|
-
/** Filter discovered tools to the minted authority snapshot. */
|
|
18
|
-
export declare function filterToolsForAuthority(request: FastifyRequest, serviceId: string, tools: Array<{
|
|
19
|
-
name: string;
|
|
20
|
-
}>): Array<{
|
|
21
|
-
name: string;
|
|
22
|
-
}>;
|
|
23
|
-
//# sourceMappingURL=execution-authority-http.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"execution-authority-http.d.ts","sourceRoot":"","sources":["../../src/lib/execution-authority-http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAqB5E,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGzF;AAED,mFAAmF;AACnF,qBAAa,0BAA2B,SAAQ,KAAK;aACvB,QAAQ,EAAE,aAAa;gBAAvB,QAAQ,EAAE,aAAa;CAIpD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAa9D;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,aAAa,EACpB,MAAM,SAA2B,6RAGlC;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,uBAAuB,EAC9B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,IAAI,CA2BN;AAED,gEAAgE;AAChE,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7B,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAWzB"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthorityContractAuthError = void 0;
|
|
4
|
-
exports.isExecutionAuthorityHttpAllowed = isExecutionAuthorityHttpAllowed;
|
|
5
|
-
exports.statusForContract = statusForContract;
|
|
6
|
-
exports.sendContractError = sendContractError;
|
|
7
|
-
exports.authorizeAuthorityServiceCall = authorizeAuthorityServiceCall;
|
|
8
|
-
exports.filterToolsForAuthority = filterToolsForAuthority;
|
|
9
|
-
const http_auth_1 = require("./http-auth");
|
|
10
|
-
const bearer_1 = require("../execution-authority/bearer");
|
|
11
|
-
/**
|
|
12
|
-
* HTTP routes an execution-authority principal may use (worker-facing reads + tool call).
|
|
13
|
-
* Live-display is intentionally excluded — unattended workers must not mutate global
|
|
14
|
-
* session display state (NOT-86 containment).
|
|
15
|
-
* Everything else is control-plane / out of containment → INTERACTION_REQUIRED.
|
|
16
|
-
*/
|
|
17
|
-
const ALLOWED = [
|
|
18
|
-
{ methods: ['GET'], pattern: /^\/api\/scope\/deck$/ },
|
|
19
|
-
{ methods: ['GET'], pattern: /^\/api\/decks\/[^/]+$/ },
|
|
20
|
-
{ methods: ['GET'], pattern: /^\/api\/decks\/[^/]+\/services$/ },
|
|
21
|
-
{ methods: ['GET'], pattern: /^\/api\/services\/[^/]+$/ },
|
|
22
|
-
{ methods: ['GET'], pattern: /^\/api\/services\/[^/]+\/tools$/ },
|
|
23
|
-
{ methods: ['POST'], pattern: /^\/api\/services\/[^/]+\/call$/ },
|
|
24
|
-
{ methods: ['GET'], pattern: /^\/api\/playbooks\/[^/]+$/ },
|
|
25
|
-
{ methods: ['GET'], pattern: /^\/api\/playbooks$/ },
|
|
26
|
-
{ methods: ['GET'], pattern: /^\/api\/playbooks\/summaries$/ },
|
|
27
|
-
{ methods: ['GET'], pattern: /^\/api\/credentials\/[^/]+$/ },
|
|
28
|
-
];
|
|
29
|
-
function isExecutionAuthorityHttpAllowed(method, pathname) {
|
|
30
|
-
const m = method.toUpperCase();
|
|
31
|
-
return ALLOWED.some((rule) => rule.methods.includes(m) && rule.pattern.test(pathname));
|
|
32
|
-
}
|
|
33
|
-
/** Contract-shaped auth/containment failure for execution-authority principals. */
|
|
34
|
-
class AuthorityContractAuthError extends Error {
|
|
35
|
-
contract;
|
|
36
|
-
constructor(contract) {
|
|
37
|
-
super(contract.message);
|
|
38
|
-
this.contract = contract;
|
|
39
|
-
this.name = 'AuthorityContractAuthError';
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.AuthorityContractAuthError = AuthorityContractAuthError;
|
|
43
|
-
function statusForContract(error) {
|
|
44
|
-
switch (error.error_code) {
|
|
45
|
-
case 'COORDINATOR_NOT_ENROLLED':
|
|
46
|
-
case 'AUTHORITY_UNKNOWN':
|
|
47
|
-
return 404;
|
|
48
|
-
case 'INVALID_MINT_REQUEST':
|
|
49
|
-
case 'IDEMPOTENCY_KEY_CONFLICT':
|
|
50
|
-
return 400;
|
|
51
|
-
case 'AUTHORITY_SECRET_INVALID':
|
|
52
|
-
return 401;
|
|
53
|
-
default:
|
|
54
|
-
return 403;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function sendContractError(reply, error, status = statusForContract(error)) {
|
|
58
|
-
return reply.status(status).send(error);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Authorize one service tool call via the ledger (audience + audit).
|
|
62
|
-
* No-op for non-authority principals.
|
|
63
|
-
*/
|
|
64
|
-
function authorizeAuthorityServiceCall(request, store, serviceId, toolName) {
|
|
65
|
-
const principal = request.requestPrincipal;
|
|
66
|
-
if (principal?.kind !== 'execution-authority') {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const bearer = (0, http_auth_1.parseBearerToken)(request);
|
|
70
|
-
const creds = bearer ? (0, bearer_1.parseAuthorityBearer)(bearer) : null;
|
|
71
|
-
if (!creds) {
|
|
72
|
-
throw new AuthorityContractAuthError({
|
|
73
|
-
ok: false,
|
|
74
|
-
error_code: 'AUTHORITY_SECRET_INVALID',
|
|
75
|
-
message: 'Invalid authority secret',
|
|
76
|
-
correlation: { authorityId: principal.authority.authorityId },
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
const result = store.invokeAuthorizedCall({
|
|
80
|
-
authorityId: creds.authorityId,
|
|
81
|
-
authoritySecret: creds.secret,
|
|
82
|
-
audience: principal.authority.audience,
|
|
83
|
-
serviceId,
|
|
84
|
-
toolName,
|
|
85
|
-
});
|
|
86
|
-
if (!result.ok) {
|
|
87
|
-
throw new AuthorityContractAuthError(result);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
/** Filter discovered tools to the minted authority snapshot. */
|
|
91
|
-
function filterToolsForAuthority(request, serviceId, tools) {
|
|
92
|
-
const principal = request.requestPrincipal;
|
|
93
|
-
if (principal?.kind !== 'execution-authority') {
|
|
94
|
-
return tools;
|
|
95
|
-
}
|
|
96
|
-
const allowed = new Set(principal.authority.allowedTools
|
|
97
|
-
.filter((t) => t.serviceId === serviceId)
|
|
98
|
-
.map((t) => t.toolName));
|
|
99
|
-
return tools.filter((t) => allowed.has(t.name));
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=execution-authority-http.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"execution-authority-http.js","sourceRoot":"","sources":["../../src/lib/execution-authority-http.ts"],"names":[],"mappings":";;;AA0BA,0EAGC;AAUD,8CAaC;AAED,8CAMC;AAMD,sEAgCC;AAGD,0DAeC;AAlHD,2CAA+C;AAC/C,0DAAqE;AAIrE;;;;;GAKG;AACH,MAAM,OAAO,GAAkD;IAC7D,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE;IACrD,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE;IACtD,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,iCAAiC,EAAE;IAChE,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,0BAA0B,EAAE;IACzD,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,iCAAiC,EAAE;IAChE,EAAE,OAAO,EAAE,CAAC,MAAM,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OAAO,CAAC,gBAAgB,CAAC;IAC3C,IAAI,SAAS,EAAE,IAAI,KAAK,qBAAqB,EAAE,CAAC;QAC9C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,GAAG,CACrB,SAAS,CAAC,SAAS,CAAC,YAAY;SAC7B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC;SACxC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAC1B,CAAC;IACF,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/mcp-stdio.d.ts
DELETED
package/dist/mcp-stdio.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-stdio.d.ts","sourceRoot":"","sources":["../src/mcp-stdio.ts"],"names":[],"mappings":""}
|
package/dist/mcp-stdio.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-stdio.js","sourceRoot":"","sources":["../src/mcp-stdio.ts"],"names":[],"mappings":";;AAAA,wEAAiF;AACjF,mDAAqD;AAErD;;;GAGG;AACH,KAAK,UAAU,mBAAmB;IAChC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,uBAAuB,CAAC;IACjF,MAAM,IAAI,GAAG,IAAI,kCAAkB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;IAC5C,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,mBAAmB,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACpC,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,KAAK,CAAC,CAAC;IAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Playbook } from '@agent-deck/shared';
|
|
2
|
-
export declare class PlaybookParseError extends Error {
|
|
3
|
-
constructor(message: string);
|
|
4
|
-
}
|
|
5
|
-
/** Parse a minimal YAML-like frontmatter block (no external YAML dependency). */
|
|
6
|
-
export declare function parseSimpleFrontmatter(block: string): Record<string, string | string[]>;
|
|
7
|
-
export declare function parsePlaybookFile(content: string, filePath: string): Playbook;
|
|
8
|
-
//# sourceMappingURL=playbook-parser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"playbook-parser.d.ts","sourceRoot":"","sources":["../../src/playbooks/playbook-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAGT,MAAM,oBAAoB,CAAC;AAE5B,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAED,iFAAiF;AACjF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAsCvF;AAMD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,CA4B7E"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlaybookParseError = void 0;
|
|
4
|
-
exports.parseSimpleFrontmatter = parseSimpleFrontmatter;
|
|
5
|
-
exports.parsePlaybookFile = parsePlaybookFile;
|
|
6
|
-
const shared_1 = require("@agent-deck/shared");
|
|
7
|
-
class PlaybookParseError extends Error {
|
|
8
|
-
constructor(message) {
|
|
9
|
-
super(message);
|
|
10
|
-
this.name = 'PlaybookParseError';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.PlaybookParseError = PlaybookParseError;
|
|
14
|
-
/** Parse a minimal YAML-like frontmatter block (no external YAML dependency). */
|
|
15
|
-
function parseSimpleFrontmatter(block) {
|
|
16
|
-
const result = {};
|
|
17
|
-
let currentListKey = null;
|
|
18
|
-
for (const rawLine of block.split('\n')) {
|
|
19
|
-
const line = rawLine.trimEnd();
|
|
20
|
-
if (!line.trim()) {
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
const listMatch = line.match(/^\s+-\s+(.+)$/);
|
|
24
|
-
if (listMatch && currentListKey) {
|
|
25
|
-
const list = result[currentListKey];
|
|
26
|
-
if (Array.isArray(list)) {
|
|
27
|
-
list.push(stripQuotes(listMatch[1].trim()));
|
|
28
|
-
}
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
const kvMatch = line.match(/^([\w-]+):\s*(.*)$/);
|
|
32
|
-
if (!kvMatch) {
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
const [, key, rawValue] = kvMatch;
|
|
36
|
-
const value = rawValue.trim();
|
|
37
|
-
if (!value) {
|
|
38
|
-
currentListKey = key;
|
|
39
|
-
result[key] = [];
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
currentListKey = null;
|
|
43
|
-
result[key] = stripQuotes(value);
|
|
44
|
-
}
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
function stripQuotes(value) {
|
|
48
|
-
return value.replace(/^["']|["']$/g, '');
|
|
49
|
-
}
|
|
50
|
-
function parsePlaybookFile(content, filePath) {
|
|
51
|
-
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/);
|
|
52
|
-
if (!match) {
|
|
53
|
-
throw new PlaybookParseError(`Missing YAML frontmatter in ${filePath}`);
|
|
54
|
-
}
|
|
55
|
-
const [, frontmatterBlock, body] = match;
|
|
56
|
-
const raw = parseSimpleFrontmatter(frontmatterBlock);
|
|
57
|
-
const frontmatter = shared_1.PlaybookFrontmatterSchema.parse({
|
|
58
|
-
id: raw.id,
|
|
59
|
-
triggers: Array.isArray(raw.triggers) ? raw.triggers : [],
|
|
60
|
-
connections: Array.isArray(raw.connections) ? raw.connections : [],
|
|
61
|
-
exec: typeof raw.exec === 'string' ? raw.exec : undefined,
|
|
62
|
-
skill: typeof raw.skill === 'string' ? raw.skill : undefined,
|
|
63
|
-
});
|
|
64
|
-
const source = filePath.includes('.agent-deck/playbooks')
|
|
65
|
-
? 'repo'
|
|
66
|
-
: 'global';
|
|
67
|
-
return {
|
|
68
|
-
id: frontmatter.id,
|
|
69
|
-
path: filePath,
|
|
70
|
-
triggers: frontmatter.triggers,
|
|
71
|
-
source,
|
|
72
|
-
frontmatter,
|
|
73
|
-
body: body.trim(),
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=playbook-parser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"playbook-parser.js","sourceRoot":"","sources":["../../src/playbooks/playbook-parser.ts"],"names":[],"mappings":";;;AAcA,wDAsCC;AAMD,8CA4BC;AAtFD,+CAI4B;AAE5B,MAAa,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AALD,gDAKC;AAED,iFAAiF;AACjF,SAAgB,sBAAsB,CAAC,KAAa;IAClD,MAAM,MAAM,GAAsC,EAAE,CAAC;IACrD,IAAI,cAAc,GAAkB,IAAI,CAAC;IAEzC,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;QAC/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