@agent-deck/backend 2.5.1 → 2.5.2
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/deck-assignment-validation.d.ts +20 -0
- package/dist/deck-assignment-validation.d.ts.map +1 -0
- package/dist/deck-assignment-validation.js +75 -0
- package/dist/deck-assignment-validation.js.map +1 -0
- package/dist/execution-authority/bearer.d.ts +15 -0
- package/dist/execution-authority/bearer.d.ts.map +1 -0
- package/dist/execution-authority/bearer.js +35 -0
- package/dist/execution-authority/bearer.js.map +1 -0
- package/dist/execution-authority/index.d.ts +6 -0
- package/dist/execution-authority/index.d.ts.map +1 -0
- package/dist/execution-authority/index.js +8 -0
- package/dist/execution-authority/index.js.map +1 -0
- package/dist/execution-authority/ledger.d.ts +85 -0
- package/dist/execution-authority/ledger.d.ts.map +1 -0
- package/dist/execution-authority/ledger.js +507 -0
- package/dist/execution-authority/ledger.js.map +1 -0
- package/dist/execution-authority/store.d.ts +55 -0
- package/dist/execution-authority/store.d.ts.map +1 -0
- package/dist/execution-authority/store.js +256 -0
- package/dist/execution-authority/store.js.map +1 -0
- package/dist/execution-authority/types.d.ts +119 -0
- package/dist/execution-authority/types.d.ts.map +1 -0
- package/dist/execution-authority/types.js +9 -0
- package/dist/execution-authority/types.js.map +1 -0
- package/dist/lib/execution-authority-http.d.ts +23 -0
- package/dist/lib/execution-authority-http.d.ts.map +1 -0
- package/dist/lib/execution-authority-http.js +101 -0
- package/dist/lib/execution-authority-http.js.map +1 -0
- package/dist/mcp-server.d.ts +35 -4
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +293 -36
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp-session-binding.d.ts +73 -2
- package/dist/mcp-session-binding.d.ts.map +1 -1
- package/dist/mcp-session-binding.js +108 -2
- package/dist/mcp-session-binding.js.map +1 -1
- package/dist/mcp-stdio.d.ts +2 -0
- package/dist/mcp-stdio.d.ts.map +1 -0
- package/dist/mcp-stdio.js.map +1 -0
- package/dist/mcp-tools/deck-assignment-elicitation.d.ts +91 -0
- package/dist/mcp-tools/deck-assignment-elicitation.d.ts.map +1 -0
- package/dist/mcp-tools/deck-assignment-elicitation.js +222 -0
- package/dist/mcp-tools/deck-assignment-elicitation.js.map +1 -0
- package/dist/mcp-tools/register.d.ts +16 -0
- package/dist/mcp-tools/register.d.ts.map +1 -1
- package/dist/mcp-tools/register.js +213 -61
- package/dist/mcp-tools/register.js.map +1 -1
- package/dist/mcp-unassigned.d.ts +28 -2
- package/dist/mcp-unassigned.d.ts.map +1 -1
- package/dist/mcp-unassigned.js +30 -3
- package/dist/mcp-unassigned.js.map +1 -1
- package/dist/playbooks/playbook-parser.d.ts +8 -0
- package/dist/playbooks/playbook-parser.d.ts.map +1 -0
- package/dist/playbooks/playbook-parser.js +76 -0
- package/dist/playbooks/playbook-parser.js.map +1 -0
- package/dist/playbooks/playbook-service.d.ts +9 -0
- package/dist/playbooks/playbook-service.d.ts.map +1 -0
- package/dist/playbooks/playbook-service.js +107 -0
- package/dist/playbooks/playbook-service.js.map +1 -0
- package/dist/routes/default-deck.d.ts +13 -0
- package/dist/routes/default-deck.d.ts.map +1 -0
- package/dist/routes/default-deck.js +36 -0
- package/dist/routes/default-deck.js.map +1 -0
- package/dist/routes/execution-authority.d.ts +8 -0
- package/dist/routes/execution-authority.d.ts.map +1 -0
- package/dist/routes/execution-authority.js +498 -0
- package/dist/routes/execution-authority.js.map +1 -0
- package/dist/routes/trusted-session.d.ts.map +1 -1
- package/dist/routes/trusted-session.js +285 -0
- package/dist/routes/trusted-session.js.map +1 -1
- package/dist/scope/bindings-sidecar.d.ts +9 -0
- package/dist/scope/bindings-sidecar.d.ts.map +1 -0
- package/dist/scope/bindings-sidecar.js +57 -0
- package/dist/scope/bindings-sidecar.js.map +1 -0
- package/dist/scope/repo-deck.d.ts +10 -0
- package/dist/scope/repo-deck.d.ts.map +1 -0
- package/dist/scope/repo-deck.js +63 -0
- package/dist/scope/repo-deck.js.map +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -0
- package/dist/server/index.js.map +1 -1
- package/dist/test-local-mcp-e2e.d.ts +3 -0
- package/dist/test-local-mcp-e2e.d.ts.map +1 -0
- package/dist/test-local-mcp-e2e.js +104 -0
- package/dist/test-local-mcp-e2e.js.map +1 -0
- package/dist/trusted-session/route-policy-registry.d.ts.map +1 -1
- package/dist/trusted-session/route-policy-registry.js +35 -0
- package/dist/trusted-session/route-policy-registry.js.map +1 -1
- package/dist/trusted-session/store.d.ts +131 -0
- package/dist/trusted-session/store.d.ts.map +1 -1
- package/dist/trusted-session/store.js +347 -1
- package/dist/trusted-session/store.js.map +1 -1
- package/package.json +2 -2
- package/static-ui/assets/{index-Bbu6K9ON.js → index-B5GT9yb2.js} +72 -57
- package/static-ui/assets/{index-BKJkKaDa.css → index-DBeN8gfw.css} +1 -1
- package/static-ui/favicon.png +0 -0
- package/static-ui/index.html +2 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type AssignmentWorkspaceValidation = {
|
|
2
|
+
ok: true;
|
|
3
|
+
workspaceRoot: string;
|
|
4
|
+
} | {
|
|
5
|
+
ok: false;
|
|
6
|
+
error: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Validate a caller-supplied folder for a deck-assignment request.
|
|
10
|
+
* Refuses a missing path, a non-absolute path, any path containing `..`,
|
|
11
|
+
* and a path that is not an existing directory. Returns the resolved
|
|
12
|
+
* absolute path on success; callers must write only inside it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function validateAssignmentWorkspace(workspace: unknown): AssignmentWorkspaceValidation;
|
|
15
|
+
/**
|
|
16
|
+
* True when `candidate` stays inside `workspaceRoot` (or equals it).
|
|
17
|
+
* Used to guarantee assignment writes never escape the approved folder.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isPathInsideWorkspace(workspaceRoot: string, candidate: string): boolean;
|
|
20
|
+
//# sourceMappingURL=deck-assignment-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deck-assignment-validation.d.ts","sourceRoot":"","sources":["../src/deck-assignment-validation.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,6BAA6B,GACrC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjC;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,OAAO,GAAG,6BAA6B,CA4B7F;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAIvF"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.validateAssignmentWorkspace = validateAssignmentWorkspace;
|
|
7
|
+
exports.isPathInsideWorkspace = isPathInsideWorkspace;
|
|
8
|
+
/**
|
|
9
|
+
* NOT-597: human-approved deck assignment for unassigned (headerless) folders.
|
|
10
|
+
*
|
|
11
|
+
* A headerless MCP session carries no `x-agent-deck-workspace`, so the
|
|
12
|
+
* server does not know the folder. The agent supplies the folder as a
|
|
13
|
+
* `workspace` path argument; the approval panel displays it in full and
|
|
14
|
+
* the path is only trusted after the user approves that panel.
|
|
15
|
+
*
|
|
16
|
+
* Why a `workspace` argument instead of MCP `roots/list`:
|
|
17
|
+
* - `roots/list` is optional — hosts may not advertise `roots`, may return
|
|
18
|
+
* an empty list, or may return multiple roots with no way to pick the
|
|
19
|
+
* intended folder without asking the agent anyway.
|
|
20
|
+
* - The observed Codex session (global headerless fallback after a 2.4.0
|
|
21
|
+
* upgrade) offers only `get_session_context`; relying on `roots/list`
|
|
22
|
+
* would leave exactly that session unable to request assignment.
|
|
23
|
+
* - An explicit argument is testable over plain HTTP (the acceptance
|
|
24
|
+
* tests use a headerless client and an existing folder) and keeps the
|
|
25
|
+
* trust boundary obvious: the daemon validates the shape, the human
|
|
26
|
+
* verifies the displayed path, and only then does the daemon write.
|
|
27
|
+
*/
|
|
28
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
29
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
30
|
+
/**
|
|
31
|
+
* Validate a caller-supplied folder for a deck-assignment request.
|
|
32
|
+
* Refuses a missing path, a non-absolute path, any path containing `..`,
|
|
33
|
+
* and a path that is not an existing directory. Returns the resolved
|
|
34
|
+
* absolute path on success; callers must write only inside it.
|
|
35
|
+
*/
|
|
36
|
+
function validateAssignmentWorkspace(workspace) {
|
|
37
|
+
if (typeof workspace !== 'string' || workspace.trim().length === 0) {
|
|
38
|
+
return { ok: false, error: 'workspace is required — pass the absolute folder path' };
|
|
39
|
+
}
|
|
40
|
+
const trimmed = workspace.trim();
|
|
41
|
+
if (trimmed.includes('..')) {
|
|
42
|
+
return { ok: false, error: 'workspace must not contain `..`' };
|
|
43
|
+
}
|
|
44
|
+
if (!node_path_1.default.isAbsolute(trimmed)) {
|
|
45
|
+
return { ok: false, error: 'workspace must be an absolute path' };
|
|
46
|
+
}
|
|
47
|
+
const resolved = node_path_1.default.resolve(trimmed);
|
|
48
|
+
// `..` was rejected above, but resolve-then-check keeps symlink-free
|
|
49
|
+
// callers honest: the resolved path must equal the trimmed input's
|
|
50
|
+
// resolution and must not escape via `.` segments.
|
|
51
|
+
if (resolved.includes('..')) {
|
|
52
|
+
return { ok: false, error: 'workspace must not contain `..`' };
|
|
53
|
+
}
|
|
54
|
+
let stat;
|
|
55
|
+
try {
|
|
56
|
+
stat = node_fs_1.default.statSync(resolved);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return { ok: false, error: 'workspace does not exist or is not accessible' };
|
|
60
|
+
}
|
|
61
|
+
if (!stat.isDirectory()) {
|
|
62
|
+
return { ok: false, error: 'workspace is not a directory' };
|
|
63
|
+
}
|
|
64
|
+
return { ok: true, workspaceRoot: resolved };
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* True when `candidate` stays inside `workspaceRoot` (or equals it).
|
|
68
|
+
* Used to guarantee assignment writes never escape the approved folder.
|
|
69
|
+
*/
|
|
70
|
+
function isPathInsideWorkspace(workspaceRoot, candidate) {
|
|
71
|
+
const root = node_path_1.default.resolve(workspaceRoot);
|
|
72
|
+
const resolved = node_path_1.default.resolve(candidate);
|
|
73
|
+
return resolved === root || resolved.startsWith(`${root}${node_path_1.default.sep}`);
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=deck-assignment-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deck-assignment-validation.js","sourceRoot":"","sources":["../src/deck-assignment-validation.ts"],"names":[],"mappings":";;;;;AAiCA,kEA4BC;AAMD,sDAIC;AAvED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,sDAAyB;AACzB,0DAA6B;AAM7B;;;;;GAKG;AACH,SAAgB,2BAA2B,CAAC,SAAkB;IAC5D,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,uDAAuD,EAAE,CAAC;IACvF,CAAC;IACD,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;IACjC,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,iCAAiC,EAAE,CAAC;IACjE,CAAC;IACD,IAAI,CAAC,mBAAI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ator enrollment / execution-authority bearer tokens.
|
|
3
|
+
* Forms: `enr_…:secret`, `authz_…:secret` (preferred), or raw secret with id header.
|
|
4
|
+
*/
|
|
5
|
+
export type EnrollmentBearer = {
|
|
6
|
+
enrollmentId: string;
|
|
7
|
+
secret: string;
|
|
8
|
+
};
|
|
9
|
+
export type AuthorityBearer = {
|
|
10
|
+
authorityId: string;
|
|
11
|
+
secret: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function parseEnrollmentBearer(token: string): EnrollmentBearer | null;
|
|
14
|
+
export declare function parseAuthorityBearer(token: string): AuthorityBearer | null;
|
|
15
|
+
//# sourceMappingURL=bearer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bearer.d.ts","sourceRoot":"","sources":["../../src/execution-authority/bearer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAS5E;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAS1E"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Parse coordinator enrollment / execution-authority bearer tokens.
|
|
4
|
+
* Forms: `enr_…:secret`, `authz_…:secret` (preferred), or raw secret with id header.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.parseEnrollmentBearer = parseEnrollmentBearer;
|
|
8
|
+
exports.parseAuthorityBearer = parseAuthorityBearer;
|
|
9
|
+
function parseEnrollmentBearer(token) {
|
|
10
|
+
const trimmed = token.trim();
|
|
11
|
+
const colon = trimmed.indexOf(':');
|
|
12
|
+
if (colon <= 0)
|
|
13
|
+
return null;
|
|
14
|
+
const enrollmentId = trimmed.slice(0, colon);
|
|
15
|
+
if (!/^enr_[A-Za-z0-9]+$/.test(enrollmentId))
|
|
16
|
+
return null;
|
|
17
|
+
const secret = trimmed.slice(colon + 1);
|
|
18
|
+
if (!secret)
|
|
19
|
+
return null;
|
|
20
|
+
return { enrollmentId, secret };
|
|
21
|
+
}
|
|
22
|
+
function parseAuthorityBearer(token) {
|
|
23
|
+
const trimmed = token.trim();
|
|
24
|
+
const colon = trimmed.indexOf(':');
|
|
25
|
+
if (colon <= 0)
|
|
26
|
+
return null;
|
|
27
|
+
const authorityId = trimmed.slice(0, colon);
|
|
28
|
+
if (!/^authz_[A-Za-z0-9]+$/.test(authorityId))
|
|
29
|
+
return null;
|
|
30
|
+
const secret = trimmed.slice(colon + 1);
|
|
31
|
+
if (!secret)
|
|
32
|
+
return null;
|
|
33
|
+
return { authorityId, secret };
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=bearer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bearer.js","sourceRoot":"","sources":["../../src/execution-authority/bearer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAYH,sDASC;AAED,oDASC;AApBD,SAAgB,qBAAqB,CAAC,KAAa;IACjD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5B,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC7C,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;AAClC,CAAC;AAED,SAAgB,oBAAoB,CAAC,KAAa;IAChD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5B,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC5C,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,WAAW,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3D,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ExecutionAuthorityLedger } from './ledger';
|
|
2
|
+
export type { LedgerState } from './ledger';
|
|
3
|
+
export { ExecutionAuthorityStore } from './store';
|
|
4
|
+
export type { ExecutionAuthorityStoreOptions } from './store';
|
|
5
|
+
export type * from './types';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/execution-authority/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAClD,YAAY,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAC9D,mBAAmB,SAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExecutionAuthorityStore = exports.ExecutionAuthorityLedger = void 0;
|
|
4
|
+
var ledger_1 = require("./ledger");
|
|
5
|
+
Object.defineProperty(exports, "ExecutionAuthorityLedger", { enumerable: true, get: function () { return ledger_1.ExecutionAuthorityLedger; } });
|
|
6
|
+
var store_1 = require("./store");
|
|
7
|
+
Object.defineProperty(exports, "ExecutionAuthorityStore", { enumerable: true, get: function () { return store_1.ExecutionAuthorityStore; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/execution-authority/index.ts"],"names":[],"mappings":";;;AAAA,mCAAoD;AAA3C,kHAAA,wBAAwB,OAAA;AAEjC,iCAAkD;AAAzC,gHAAA,uBAAuB,OAAA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-memory execution-authority ledger (NOT-85 logic engine).
|
|
3
|
+
* Durable SQLite wrapper: `ExecutionAuthorityStore` (NOT-86).
|
|
4
|
+
*/
|
|
5
|
+
import type { AuditEvent, AuthorizedCallInput, ContractResult, CoordinatorEnrollment, EnrollCoordinatorResult, ExecutionAuthority, MintAuthorityInput, MintAuthorityResult } from './types';
|
|
6
|
+
/** Serializable ledger state for durable hydrate/persist. */
|
|
7
|
+
export type LedgerState = {
|
|
8
|
+
enrollments: CoordinatorEnrollment[];
|
|
9
|
+
enrollmentSecretHashes: Array<{
|
|
10
|
+
enrollmentId: string;
|
|
11
|
+
secretHash: string;
|
|
12
|
+
}>;
|
|
13
|
+
authorities: ExecutionAuthority[];
|
|
14
|
+
secretHashes: Array<{
|
|
15
|
+
authorityId: string;
|
|
16
|
+
secretHash: string;
|
|
17
|
+
}>;
|
|
18
|
+
mintIndex: Array<{
|
|
19
|
+
enrollmentId: string;
|
|
20
|
+
idempotencyKey: string;
|
|
21
|
+
authorityId: string;
|
|
22
|
+
}>;
|
|
23
|
+
audit: AuditEvent[];
|
|
24
|
+
};
|
|
25
|
+
export interface ExecutionAuthorityLedgerOptions {
|
|
26
|
+
/** Injectable clock for expiry tests. */
|
|
27
|
+
now?: () => Date;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Deck-side authorization ledger (skeleton). Authoritative for enrollment and
|
|
31
|
+
* execution authority; does not model Dealer run lifecycle.
|
|
32
|
+
*/
|
|
33
|
+
export declare class ExecutionAuthorityLedger {
|
|
34
|
+
private readonly enrollments;
|
|
35
|
+
private readonly enrollmentSecretHashes;
|
|
36
|
+
private readonly authorities;
|
|
37
|
+
private readonly secretHashes;
|
|
38
|
+
private readonly mintIndex;
|
|
39
|
+
private readonly audit;
|
|
40
|
+
private readonly now;
|
|
41
|
+
constructor(options?: ExecutionAuthorityLedgerOptions);
|
|
42
|
+
exportState(): LedgerState;
|
|
43
|
+
replaceState(state: LedgerState): void;
|
|
44
|
+
getEnrollment(enrollmentId: string): CoordinatorEnrollment | undefined;
|
|
45
|
+
listEnrollments(): CoordinatorEnrollment[];
|
|
46
|
+
verifyEnrollmentSecret(enrollmentId: string, secret: string): boolean;
|
|
47
|
+
verifyAuthoritySecret(authorityId: string, secret: string): boolean;
|
|
48
|
+
enrollCoordinator(input: {
|
|
49
|
+
coordinatorId: string;
|
|
50
|
+
allowedDeckIds: string[];
|
|
51
|
+
}): ContractResult<EnrollCoordinatorResult>;
|
|
52
|
+
revokeEnrollment(enrollmentId: string): ContractResult<{
|
|
53
|
+
enrollmentId: string;
|
|
54
|
+
}>;
|
|
55
|
+
mintAuthority(input: MintAuthorityInput): ContractResult<MintAuthorityResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Non-auditing lookup for ownership / existence checks.
|
|
58
|
+
* Does not refresh expiry (avoids authority_expired side effects during probes).
|
|
59
|
+
*/
|
|
60
|
+
peekAuthority(authorityId: string): ExecutionAuthority | undefined;
|
|
61
|
+
inspectAuthority(authorityId: string): ContractResult<ExecutionAuthority>;
|
|
62
|
+
revokeAuthority(authorityId: string): ContractResult<{
|
|
63
|
+
authorityId: string;
|
|
64
|
+
}>;
|
|
65
|
+
/**
|
|
66
|
+
* Simulate one authorized Deck tool call under execution authority.
|
|
67
|
+
* Never waits for human approval — returns INTERACTION_REQUIRED immediately.
|
|
68
|
+
*/
|
|
69
|
+
invokeAuthorizedCall(input: AuthorizedCallInput): ContractResult<{
|
|
70
|
+
serviceId: string;
|
|
71
|
+
toolName: string;
|
|
72
|
+
result: string;
|
|
73
|
+
}>;
|
|
74
|
+
listAuditEvents(filter?: {
|
|
75
|
+
runId?: string;
|
|
76
|
+
attemptId?: string;
|
|
77
|
+
authorityId?: string;
|
|
78
|
+
enrollmentId?: string;
|
|
79
|
+
requestId?: string;
|
|
80
|
+
}): AuditEvent[];
|
|
81
|
+
private toolAllowed;
|
|
82
|
+
private refreshAuthorityStatus;
|
|
83
|
+
private pushAudit;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../src/execution-authority/ledger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAGV,UAAU,EAEV,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAMjB,6DAA6D;AAC7D,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,qBAAqB,EAAE,CAAC;IACrC,sBAAsB,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAA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