@axiastudio/aioc 0.2.0 → 0.2.1
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/README.md +11 -5
- package/dist/approval-helpers.d.ts +24 -0
- package/dist/approval-helpers.d.ts.map +1 -0
- package/dist/approval-helpers.js +94 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,14 +8,18 @@ Project home and documentation: [https://axiastudio.github.io/aioc](https://axia
|
|
|
8
8
|
|
|
9
9
|
## Release Status
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Current stable release: `0.2.1`.
|
|
12
|
+
The stable line started with `0.1.0`.
|
|
12
13
|
The core runtime surface is compatibility-managed. Breaking changes to the stable surface should ship only with explicit migration guidance and release notes.
|
|
13
14
|
|
|
14
15
|
### Stable Scope
|
|
15
16
|
|
|
16
|
-
AIOC `0.1.0`
|
|
17
|
+
AIOC `0.1.0` stabilized the core runtime surface, public documentation aligned to the exported contract, `RunRecord` and replay/compare workflows, and the governance-first runtime model validated in real applications beyond toy examples.
|
|
18
|
+
AIOC `0.1.1` adds thread-history utilities, the run-output stream adapter, and provider-specific instruction-role documentation without changing the stable governance model.
|
|
19
|
+
AIOC `0.1.2` adds approval evidence helpers for application-owned approval workflows.
|
|
17
20
|
|
|
18
21
|
AIOC `0.2.0` adds implemented runtime utilities and an experimental Agent Harness Descriptor surface. The core runtime remains compatibility-managed; descriptor shape and loader helpers may still evolve across `0.x` minor releases with explicit migration guidance.
|
|
22
|
+
AIOC `0.2.1` realigns the `0.2.x` package line with the current `main` history after `0.2.0` was published from the descriptor release branch.
|
|
19
23
|
|
|
20
24
|
- Release notes: `CHANGELOG.md`
|
|
21
25
|
- Historical beta contract snapshot: `docs/BETA-CONTRACT.md`
|
|
@@ -96,6 +100,7 @@ console.log(result.finalOutput);
|
|
|
96
100
|
- handoffs via `Agent({ handoffs: [...] })`
|
|
97
101
|
- `run(...)` with streaming support (`stream` defaults to `false`)
|
|
98
102
|
- policy helpers `allow(...)` / `deny(...)` / `requireApproval(...)`
|
|
103
|
+
- approval evidence helpers `createApprovalRequestSeed(...)`, `toApprovedProposalHashes(...)`, `toActiveApprovalGrantMap(...)`
|
|
99
104
|
- provider setup helpers `setupMistral(...)`, `setupOpenAI(...)`, `setupProvider(...)`
|
|
100
105
|
- run logger hook `run(..., { logger })`
|
|
101
106
|
- run record hook `run(..., { record })`
|
|
@@ -104,7 +109,7 @@ console.log(result.finalOutput);
|
|
|
104
109
|
- thread history utilities `toThreadHistory(...)`, `appendUserMessage(...)`, `replaceThreadHistory(...)`, `applyRunResultHistory(...)`
|
|
105
110
|
- JSON helper `toJsonValue(...)`
|
|
106
111
|
|
|
107
|
-
## Experimental 0.2.
|
|
112
|
+
## Experimental 0.2.x Surface
|
|
108
113
|
|
|
109
114
|
- `buildAgentHarness(...)`
|
|
110
115
|
- `hashAgentHarnessDescriptor(...)`
|
|
@@ -112,7 +117,7 @@ console.log(result.finalOutput);
|
|
|
112
117
|
- `loadAgentHarnessDescriptorFromFile(...)`
|
|
113
118
|
- `AgentHarnessDescriptor` and related descriptor types
|
|
114
119
|
|
|
115
|
-
The Agent Harness Descriptor is included in `0.2.
|
|
120
|
+
The Agent Harness Descriptor is included in the `0.2.x` line as an experimental `aioc.agent_graph.v0` descriptor surface. Use it for controlled configuration, examples, and evaluation harnesses; keep executable tools, policies, providers, persistence, approvals, and deployment configuration in application code.
|
|
116
121
|
|
|
117
122
|
## Policy Gate (Minimal)
|
|
118
123
|
|
|
@@ -274,10 +279,11 @@ AIOC adopts the following non-negotiable principles:
|
|
|
274
279
|
- `docs/RFC-0003-run-record-audit-trail-and-persistence.md` (`Accepted`)
|
|
275
280
|
- `docs/RFC-0004-policy-outcomes-and-approval-model.md` (`Accepted`)
|
|
276
281
|
- `docs/RFC-0005-suspended-proposals-and-approval-lifecycle.md` (`Accepted`)
|
|
277
|
-
- `docs/RFC-0006-approval-evidence-helpers.md` (`
|
|
282
|
+
- `docs/RFC-0006-approval-evidence-helpers.md` (`Accepted`)
|
|
278
283
|
- `docs/RFC-0007-thread-state-utilities.md` (`Accepted`)
|
|
279
284
|
- `docs/RFC-0008-run-stream-consumer-utilities.md` (`Accepted`)
|
|
280
285
|
- `docs/RFC-0009-governance-events-and-exporters.md` (`Experimental`)
|
|
286
|
+
- `docs/RFC-0010-policy-composition-helpers.md` (`Draft`)
|
|
281
287
|
- `docs/RFC-0011-agent-harness-descriptor.md` (`Experimental`)
|
|
282
288
|
- `docs/PRIVACY-BASELINE.md`
|
|
283
289
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SuspendedProposal } from "./run-record";
|
|
2
|
+
export interface ApprovalGrant {
|
|
3
|
+
proposalHash: string;
|
|
4
|
+
approvedAt: string;
|
|
5
|
+
expiresAt?: string;
|
|
6
|
+
revokedAt?: string;
|
|
7
|
+
metadata?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export interface ApprovalRequestSeed {
|
|
10
|
+
proposalHash: string;
|
|
11
|
+
kind: "tool" | "handoff";
|
|
12
|
+
reason: string;
|
|
13
|
+
publicReason?: string;
|
|
14
|
+
policyVersion?: string;
|
|
15
|
+
expiresAt?: string;
|
|
16
|
+
resourceName: string;
|
|
17
|
+
canonicalPayloadJson: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function createApprovalRequestSeed(proposal: SuspendedProposal): ApprovalRequestSeed;
|
|
20
|
+
export declare function isApprovalGrantActive(grant: ApprovalGrant, now?: string): boolean;
|
|
21
|
+
export declare function findActiveApprovalGrant(proposalHash: string, grants: readonly ApprovalGrant[], now?: string): ApprovalGrant | null;
|
|
22
|
+
export declare function toActiveApprovalGrantMap(grants: readonly ApprovalGrant[], now?: string): Record<string, ApprovalGrant>;
|
|
23
|
+
export declare function toApprovedProposalHashes(grants: readonly ApprovalGrant[], now?: string): string[];
|
|
24
|
+
//# sourceMappingURL=approval-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-helpers.d.ts","sourceRoot":"","sources":["../src/approval-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAsCD,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,iBAAiB,GAC1B,mBAAmB,CAoBrB;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,aAAa,EACpB,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAYT;AAED,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,GAAG,CAAC,EAAE,MAAM,GACX,aAAa,GAAG,IAAI,CAgBtB;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,GAAG,CAAC,EAAE,MAAM,GACX,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAe/B;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,GAAG,CAAC,EAAE,MAAM,GACX,MAAM,EAAE,CAEV"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createApprovalRequestSeed = createApprovalRequestSeed;
|
|
4
|
+
exports.isApprovalGrantActive = isApprovalGrantActive;
|
|
5
|
+
exports.findActiveApprovalGrant = findActiveApprovalGrant;
|
|
6
|
+
exports.toActiveApprovalGrantMap = toActiveApprovalGrantMap;
|
|
7
|
+
exports.toApprovedProposalHashes = toApprovedProposalHashes;
|
|
8
|
+
function parseTimestamp(value, label) {
|
|
9
|
+
const timestamp = Date.parse(value);
|
|
10
|
+
if (Number.isNaN(timestamp)) {
|
|
11
|
+
throw new Error(`${label} must be a valid timestamp.`);
|
|
12
|
+
}
|
|
13
|
+
return timestamp;
|
|
14
|
+
}
|
|
15
|
+
function getNowTimestamp(now) {
|
|
16
|
+
return parseTimestamp(now ?? new Date().toISOString(), "now");
|
|
17
|
+
}
|
|
18
|
+
function isGrantNewer(candidate, current) {
|
|
19
|
+
return (parseTimestamp(candidate.approvedAt, "grant.approvedAt") >
|
|
20
|
+
parseTimestamp(current.approvedAt, "grant.approvedAt"));
|
|
21
|
+
}
|
|
22
|
+
function getProposalMetadata(proposal) {
|
|
23
|
+
return {
|
|
24
|
+
...(typeof proposal.publicReason !== "undefined"
|
|
25
|
+
? { publicReason: proposal.publicReason }
|
|
26
|
+
: {}),
|
|
27
|
+
...(typeof proposal.policyVersion !== "undefined"
|
|
28
|
+
? { policyVersion: proposal.policyVersion }
|
|
29
|
+
: {}),
|
|
30
|
+
...(typeof proposal.expiresAt !== "undefined"
|
|
31
|
+
? { expiresAt: proposal.expiresAt }
|
|
32
|
+
: {}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function createApprovalRequestSeed(proposal) {
|
|
36
|
+
if (proposal.kind === "tool") {
|
|
37
|
+
return {
|
|
38
|
+
proposalHash: proposal.proposalHash,
|
|
39
|
+
kind: proposal.kind,
|
|
40
|
+
reason: proposal.reason,
|
|
41
|
+
...getProposalMetadata(proposal),
|
|
42
|
+
resourceName: proposal.toolName,
|
|
43
|
+
canonicalPayloadJson: proposal.argsCanonicalJson,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
proposalHash: proposal.proposalHash,
|
|
48
|
+
kind: proposal.kind,
|
|
49
|
+
reason: proposal.reason,
|
|
50
|
+
...getProposalMetadata(proposal),
|
|
51
|
+
resourceName: proposal.toAgentName,
|
|
52
|
+
canonicalPayloadJson: proposal.payloadCanonicalJson,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function isApprovalGrantActive(grant, now) {
|
|
56
|
+
if (typeof grant.revokedAt !== "undefined") {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
if (typeof grant.expiresAt === "undefined") {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
return (parseTimestamp(grant.expiresAt, "grant.expiresAt") >= getNowTimestamp(now));
|
|
63
|
+
}
|
|
64
|
+
function findActiveApprovalGrant(proposalHash, grants, now) {
|
|
65
|
+
let match = null;
|
|
66
|
+
for (const grant of grants) {
|
|
67
|
+
if (grant.proposalHash !== proposalHash) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (!isApprovalGrantActive(grant, now)) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (!match || isGrantNewer(grant, match)) {
|
|
74
|
+
match = grant;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return match;
|
|
78
|
+
}
|
|
79
|
+
function toActiveApprovalGrantMap(grants, now) {
|
|
80
|
+
const grantMap = {};
|
|
81
|
+
for (const grant of grants) {
|
|
82
|
+
if (!isApprovalGrantActive(grant, now)) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const current = grantMap[grant.proposalHash];
|
|
86
|
+
if (!current || isGrantNewer(grant, current)) {
|
|
87
|
+
grantMap[grant.proposalHash] = grant;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return grantMap;
|
|
91
|
+
}
|
|
92
|
+
function toApprovedProposalHashes(grants, now) {
|
|
93
|
+
return Object.keys(toActiveApprovalGrantMap(grants, now));
|
|
94
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,OAAO,CAAC;AACtB,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,OAAO,CAAC;AACtB,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./agent"), exports);
|
|
18
|
+
__exportStar(require("./approval-helpers"), exports);
|
|
18
19
|
__exportStar(require("./config"), exports);
|
|
19
20
|
__exportStar(require("./errors"), exports);
|
|
20
21
|
__exportStar(require("./guardrails"), exports);
|