@axtary/proxy 0.0.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 +29 -0
- package/dist/index.d.ts +94 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +303 -0
- package/dist/index.js.map +1 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @axtary/proxy
|
|
2
|
+
|
|
3
|
+
Local fail-closed runtime proxy for Axtary policy, ActionPass issuance, and ledger recording.
|
|
4
|
+
|
|
5
|
+
This package is private workspace code while the local runtime plane is still being shaped.
|
|
6
|
+
|
|
7
|
+
## What It Does
|
|
8
|
+
|
|
9
|
+
- Parses a normalized Axtary action.
|
|
10
|
+
- Evaluates it through `@axtary/policy`.
|
|
11
|
+
- Requires ActionPass signing before execution by default.
|
|
12
|
+
- Appends every executable or blocked decision to `@axtary/ledger`.
|
|
13
|
+
- Executes only registered handlers for allowed tools.
|
|
14
|
+
- Can resolve exact approval evidence for `step_up` decisions before issuing a pass.
|
|
15
|
+
- Returns structured blocked, executed, failed, and malformed results.
|
|
16
|
+
- Returns per-stage timings for parse, policy, ActionPass issuance, ledger append, handler execution, and total latency.
|
|
17
|
+
- Accepts either a static policy object or an async policy getter for hot-reloaded local configs.
|
|
18
|
+
|
|
19
|
+
## Design Notes
|
|
20
|
+
|
|
21
|
+
The proxy is the first runtime enforcement surface. It is intentionally local and deterministic. Real adapters register handlers and let the proxy own the decision, pass issuance, and ledger write before any production tool is touched.
|
|
22
|
+
|
|
23
|
+
Unsigned execution is possible only with `allowUnsignedExecution: true`, which is meant for dry-run tests and local demos.
|
|
24
|
+
|
|
25
|
+
Handlers are bounded by `handlerTimeoutMs` from config. Timeout failures are recorded as failed executions after the allow decision is ledgered, which keeps the authorization trace intact without letting slow providers stall the runtime.
|
|
26
|
+
|
|
27
|
+
When a dynamic policy getter fails, the proxy fails closed, records a deny decision in the ledger, and does not call the downstream handler. That preserves the audit trail while avoiding stale or partially parsed policy.
|
|
28
|
+
|
|
29
|
+
`approvalResolver` is the local bridge to hosted or local approval queues. It receives the normalized action and `step_up` policy decision, and may return a payload-bound approval artifact. If resolution fails, returns nothing, or the artifact does not bind to the exact action, the proxy blocks before handler execution.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type Approval, type ApprovalArtifact, type IssueActionPassResult, type JsonValue, type LedgerRecord, type NormalizedAction, type PolicyDecision, type SigningAlgorithm, type SigningKey } from "@axtary/actionpass";
|
|
2
|
+
import type { LedgerAppendResult, LocalJsonlLedger } from "@axtary/ledger";
|
|
3
|
+
import { type PolicyConfig } from "@axtary/policy";
|
|
4
|
+
export declare const PROXY_SCHEMA_VERSION = "axtary.proxy.v0";
|
|
5
|
+
export declare const PROXY_POLICY_VERSION = "2026-05-30";
|
|
6
|
+
export declare const DEFAULT_HANDLER_TIMEOUT_MS = 10000;
|
|
7
|
+
export type ProxyLedger = Pick<LocalJsonlLedger, "appendDecision">;
|
|
8
|
+
export type ProxyTimings = {
|
|
9
|
+
totalMs: number;
|
|
10
|
+
parseMs: number;
|
|
11
|
+
policyMs: number;
|
|
12
|
+
actionPassMs: number;
|
|
13
|
+
ledgerMs: number;
|
|
14
|
+
approvalMs: number;
|
|
15
|
+
handlerMs: number;
|
|
16
|
+
};
|
|
17
|
+
export type ToolHandlerRequest = {
|
|
18
|
+
action: NormalizedAction;
|
|
19
|
+
decision: PolicyDecision;
|
|
20
|
+
actionPass: IssueActionPassResult | null;
|
|
21
|
+
ledgerRecord: LedgerRecord;
|
|
22
|
+
};
|
|
23
|
+
export type ToolHandler = (request: ToolHandlerRequest) => JsonValue | Promise<JsonValue>;
|
|
24
|
+
export type ProxyApprovalRequest = {
|
|
25
|
+
action: NormalizedAction;
|
|
26
|
+
decision: PolicyDecision;
|
|
27
|
+
};
|
|
28
|
+
export type ProxyApprovalResult = Approval | ApprovalArtifact | {
|
|
29
|
+
approval?: Approval;
|
|
30
|
+
approvalArtifact?: ApprovalArtifact;
|
|
31
|
+
} | null | undefined;
|
|
32
|
+
export type ProxyApprovalResolver = (request: ProxyApprovalRequest) => ProxyApprovalResult | Promise<ProxyApprovalResult>;
|
|
33
|
+
export type ProxyRuntimeConfig = {
|
|
34
|
+
issuer: string;
|
|
35
|
+
tenant: string;
|
|
36
|
+
ledger: ProxyLedger;
|
|
37
|
+
handlers?: Readonly<Record<string, ToolHandler>>;
|
|
38
|
+
policy?: Partial<PolicyConfig> | (() => Partial<PolicyConfig> | Promise<Partial<PolicyConfig>>);
|
|
39
|
+
signingKey?: SigningKey;
|
|
40
|
+
keyId?: string;
|
|
41
|
+
algorithm?: SigningAlgorithm;
|
|
42
|
+
approvalResolver?: ProxyApprovalResolver;
|
|
43
|
+
allowUnsignedExecution?: boolean;
|
|
44
|
+
handlerTimeoutMs?: number;
|
|
45
|
+
now?: () => Date;
|
|
46
|
+
};
|
|
47
|
+
export type ProxyMalformedResult = {
|
|
48
|
+
schemaVersion: typeof PROXY_SCHEMA_VERSION;
|
|
49
|
+
status: "malformed";
|
|
50
|
+
error: {
|
|
51
|
+
reason: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export type ProxyBlockedResult = {
|
|
55
|
+
schemaVersion: typeof PROXY_SCHEMA_VERSION;
|
|
56
|
+
status: "blocked";
|
|
57
|
+
action: NormalizedAction;
|
|
58
|
+
decision: PolicyDecision;
|
|
59
|
+
actionPass: null;
|
|
60
|
+
ledger: LedgerAppendResult;
|
|
61
|
+
timings: ProxyTimings;
|
|
62
|
+
};
|
|
63
|
+
export type ProxyExecutedResult = {
|
|
64
|
+
schemaVersion: typeof PROXY_SCHEMA_VERSION;
|
|
65
|
+
status: "executed";
|
|
66
|
+
action: NormalizedAction;
|
|
67
|
+
decision: PolicyDecision;
|
|
68
|
+
actionPass: IssueActionPassResult | null;
|
|
69
|
+
ledger: LedgerAppendResult;
|
|
70
|
+
result: JsonValue;
|
|
71
|
+
timings: ProxyTimings;
|
|
72
|
+
};
|
|
73
|
+
export type ProxyFailedResult = {
|
|
74
|
+
schemaVersion: typeof PROXY_SCHEMA_VERSION;
|
|
75
|
+
status: "failed";
|
|
76
|
+
action: NormalizedAction;
|
|
77
|
+
decision: PolicyDecision;
|
|
78
|
+
actionPass: IssueActionPassResult | null;
|
|
79
|
+
ledger: LedgerAppendResult;
|
|
80
|
+
error: {
|
|
81
|
+
reason: string;
|
|
82
|
+
};
|
|
83
|
+
timings: ProxyTimings;
|
|
84
|
+
};
|
|
85
|
+
export type ProxyHandleResult = ProxyMalformedResult | ProxyBlockedResult | ProxyExecutedResult | ProxyFailedResult;
|
|
86
|
+
export declare class AxtaryProxyRuntime {
|
|
87
|
+
readonly config: ProxyRuntimeConfig;
|
|
88
|
+
constructor(config: ProxyRuntimeConfig);
|
|
89
|
+
handle(actionInput: unknown): Promise<ProxyHandleResult>;
|
|
90
|
+
private append;
|
|
91
|
+
private now;
|
|
92
|
+
}
|
|
93
|
+
export declare function createProxyRuntime(config: ProxyRuntimeConfig): AxtaryProxyRuntime;
|
|
94
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnE,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AACtD,eAAO,MAAM,oBAAoB,eAAe,CAAC;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AEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,OAAO,oBAAoB,CAAC;IAC3C,MAAM,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,cAAc,CAAC;IACzB,UAAU,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACzC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,EAAE;QACL,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,OAAO,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB,oBAAoB,GACpB,kBAAkB,GAClB,mBAAmB,GACnB,iBAAiB,CAAC;AAEtB,qBAAa,kBAAkB;IAC7B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;gBAExB,MAAM,EAAE,kBAAkB;IAIhC,MAAM,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA6O9D,OAAO,CAAC,MAAM;IAad,OAAO,CAAC,GAAG;CAGZ;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAEjF"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { APPROVAL_ARTIFACT_VERSION, DEFAULT_EXPIRES_IN_SECONDS, issueActionPass, parseNormalizedAction, } from "@axtary/actionpass";
|
|
2
|
+
import { evaluatePolicy } from "@axtary/policy";
|
|
3
|
+
import { performance } from "node:perf_hooks";
|
|
4
|
+
export const PROXY_SCHEMA_VERSION = "axtary.proxy.v0";
|
|
5
|
+
export const PROXY_POLICY_VERSION = "2026-05-30";
|
|
6
|
+
export const DEFAULT_HANDLER_TIMEOUT_MS = 10_000;
|
|
7
|
+
export class AxtaryProxyRuntime {
|
|
8
|
+
config;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.config = config;
|
|
11
|
+
}
|
|
12
|
+
async handle(actionInput) {
|
|
13
|
+
const startedAt = performance.now();
|
|
14
|
+
const timings = createTimings();
|
|
15
|
+
let action;
|
|
16
|
+
try {
|
|
17
|
+
const parseStartedAt = performance.now();
|
|
18
|
+
action = parseNormalizedAction(actionInput);
|
|
19
|
+
timings.parseMs = elapsed(parseStartedAt);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
return {
|
|
23
|
+
schemaVersion: PROXY_SCHEMA_VERSION,
|
|
24
|
+
status: "malformed",
|
|
25
|
+
error: {
|
|
26
|
+
reason: errorToReason(error),
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const policyStartedAt = performance.now();
|
|
31
|
+
let policyDecision;
|
|
32
|
+
try {
|
|
33
|
+
const resolvedPolicy = typeof this.config.policy === "function"
|
|
34
|
+
? await this.config.policy()
|
|
35
|
+
: this.config.policy;
|
|
36
|
+
policyDecision = evaluatePolicy(action, resolvedPolicy);
|
|
37
|
+
timings.policyMs = elapsed(policyStartedAt);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
timings.policyMs = elapsed(policyStartedAt);
|
|
41
|
+
const decision = proxyDeny([`proxy_policy_resolution_failed:${errorToReason(error)}`]);
|
|
42
|
+
const ledgerStartedAt = performance.now();
|
|
43
|
+
const ledger = await this.append(action, decision, null);
|
|
44
|
+
timings.ledgerMs = elapsed(ledgerStartedAt);
|
|
45
|
+
timings.totalMs = elapsed(startedAt);
|
|
46
|
+
return {
|
|
47
|
+
schemaVersion: PROXY_SCHEMA_VERSION,
|
|
48
|
+
status: "blocked",
|
|
49
|
+
action,
|
|
50
|
+
decision,
|
|
51
|
+
actionPass: null,
|
|
52
|
+
ledger,
|
|
53
|
+
timings,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
let approvalEvidence = {};
|
|
57
|
+
if (policyDecision.decision === "step_up" && this.config.approvalResolver) {
|
|
58
|
+
const approvalStartedAt = performance.now();
|
|
59
|
+
try {
|
|
60
|
+
approvalEvidence = normalizeApprovalResult(await this.config.approvalResolver({
|
|
61
|
+
action,
|
|
62
|
+
decision: policyDecision,
|
|
63
|
+
}));
|
|
64
|
+
timings.approvalMs = elapsed(approvalStartedAt);
|
|
65
|
+
if (approvalEvidence.approval || approvalEvidence.approvalArtifact) {
|
|
66
|
+
policyDecision = approveStepUp(policyDecision);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
timings.approvalMs = elapsed(approvalStartedAt);
|
|
71
|
+
const decision = proxyDeny([`proxy_approval_resolution_failed:${errorToReason(error)}`], policyDecision);
|
|
72
|
+
const ledgerStartedAt = performance.now();
|
|
73
|
+
const ledger = await this.append(action, decision, null);
|
|
74
|
+
timings.ledgerMs = elapsed(ledgerStartedAt);
|
|
75
|
+
timings.totalMs = elapsed(startedAt);
|
|
76
|
+
return {
|
|
77
|
+
schemaVersion: PROXY_SCHEMA_VERSION,
|
|
78
|
+
status: "blocked",
|
|
79
|
+
action,
|
|
80
|
+
decision,
|
|
81
|
+
actionPass: null,
|
|
82
|
+
ledger,
|
|
83
|
+
timings,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (policyDecision.decision !== "allow") {
|
|
88
|
+
const ledgerStartedAt = performance.now();
|
|
89
|
+
const ledger = await this.append(action, policyDecision, null);
|
|
90
|
+
timings.ledgerMs = elapsed(ledgerStartedAt);
|
|
91
|
+
timings.totalMs = elapsed(startedAt);
|
|
92
|
+
return {
|
|
93
|
+
schemaVersion: PROXY_SCHEMA_VERSION,
|
|
94
|
+
status: "blocked",
|
|
95
|
+
action,
|
|
96
|
+
decision: policyDecision,
|
|
97
|
+
actionPass: null,
|
|
98
|
+
ledger,
|
|
99
|
+
timings,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const handler = this.config.handlers?.[action.capability.tool];
|
|
103
|
+
if (!handler) {
|
|
104
|
+
const decision = proxyDeny([`proxy_handler_missing:${action.capability.tool}`], policyDecision);
|
|
105
|
+
const ledgerStartedAt = performance.now();
|
|
106
|
+
const ledger = await this.append(action, decision, null);
|
|
107
|
+
timings.ledgerMs = elapsed(ledgerStartedAt);
|
|
108
|
+
timings.totalMs = elapsed(startedAt);
|
|
109
|
+
return {
|
|
110
|
+
schemaVersion: PROXY_SCHEMA_VERSION,
|
|
111
|
+
status: "blocked",
|
|
112
|
+
action,
|
|
113
|
+
decision,
|
|
114
|
+
actionPass: null,
|
|
115
|
+
ledger,
|
|
116
|
+
timings,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
if (!this.config.signingKey && this.config.allowUnsignedExecution !== true) {
|
|
120
|
+
const decision = proxyDeny(["proxy_signing_key_required"], policyDecision);
|
|
121
|
+
const ledgerStartedAt = performance.now();
|
|
122
|
+
const ledger = await this.append(action, decision, null);
|
|
123
|
+
timings.ledgerMs = elapsed(ledgerStartedAt);
|
|
124
|
+
timings.totalMs = elapsed(startedAt);
|
|
125
|
+
return {
|
|
126
|
+
schemaVersion: PROXY_SCHEMA_VERSION,
|
|
127
|
+
status: "blocked",
|
|
128
|
+
action,
|
|
129
|
+
decision,
|
|
130
|
+
actionPass: null,
|
|
131
|
+
ledger,
|
|
132
|
+
timings,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
let actionPass = null;
|
|
136
|
+
if (this.config.signingKey) {
|
|
137
|
+
try {
|
|
138
|
+
const actionPassStartedAt = performance.now();
|
|
139
|
+
actionPass = await issueActionPass({
|
|
140
|
+
action,
|
|
141
|
+
decision: policyDecision,
|
|
142
|
+
issuer: this.config.issuer,
|
|
143
|
+
tenant: this.config.tenant,
|
|
144
|
+
signingKey: this.config.signingKey,
|
|
145
|
+
keyId: this.config.keyId,
|
|
146
|
+
algorithm: this.config.algorithm,
|
|
147
|
+
now: this.now(),
|
|
148
|
+
approval: approvalEvidence.approval,
|
|
149
|
+
approvalArtifact: approvalEvidence.approvalArtifact,
|
|
150
|
+
});
|
|
151
|
+
timings.actionPassMs = elapsed(actionPassStartedAt);
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
const decision = proxyDeny(["proxy_actionpass_issue_failed"], policyDecision);
|
|
155
|
+
const ledgerStartedAt = performance.now();
|
|
156
|
+
const ledger = await this.append(action, decision, null);
|
|
157
|
+
timings.ledgerMs = elapsed(ledgerStartedAt);
|
|
158
|
+
timings.totalMs = elapsed(startedAt);
|
|
159
|
+
return {
|
|
160
|
+
schemaVersion: PROXY_SCHEMA_VERSION,
|
|
161
|
+
status: "blocked",
|
|
162
|
+
action,
|
|
163
|
+
decision,
|
|
164
|
+
actionPass: null,
|
|
165
|
+
ledger,
|
|
166
|
+
timings,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const ledgerStartedAt = performance.now();
|
|
171
|
+
const ledger = await this.append(action, policyDecision, actionPass?.claims.jti ?? null);
|
|
172
|
+
timings.ledgerMs = elapsed(ledgerStartedAt);
|
|
173
|
+
const handlerStartedAt = performance.now();
|
|
174
|
+
try {
|
|
175
|
+
const result = await withTimeout(handler({
|
|
176
|
+
action,
|
|
177
|
+
decision: policyDecision,
|
|
178
|
+
actionPass,
|
|
179
|
+
ledgerRecord: ledger.record,
|
|
180
|
+
}), this.config.handlerTimeoutMs ?? DEFAULT_HANDLER_TIMEOUT_MS);
|
|
181
|
+
timings.handlerMs = elapsed(handlerStartedAt);
|
|
182
|
+
timings.totalMs = elapsed(startedAt);
|
|
183
|
+
return {
|
|
184
|
+
schemaVersion: PROXY_SCHEMA_VERSION,
|
|
185
|
+
status: "executed",
|
|
186
|
+
action,
|
|
187
|
+
decision: policyDecision,
|
|
188
|
+
actionPass,
|
|
189
|
+
ledger,
|
|
190
|
+
result,
|
|
191
|
+
timings,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
timings.handlerMs = elapsed(handlerStartedAt);
|
|
196
|
+
timings.totalMs = elapsed(startedAt);
|
|
197
|
+
return {
|
|
198
|
+
schemaVersion: PROXY_SCHEMA_VERSION,
|
|
199
|
+
status: "failed",
|
|
200
|
+
action,
|
|
201
|
+
decision: policyDecision,
|
|
202
|
+
actionPass,
|
|
203
|
+
ledger,
|
|
204
|
+
error: {
|
|
205
|
+
reason: errorToReason(error),
|
|
206
|
+
},
|
|
207
|
+
timings,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
append(action, decision, actionPassId) {
|
|
212
|
+
return this.config.ledger.appendDecision({
|
|
213
|
+
action,
|
|
214
|
+
decision,
|
|
215
|
+
actionPassId,
|
|
216
|
+
occurredAt: this.now(),
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
now() {
|
|
220
|
+
return this.config.now?.() ?? new Date();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
export function createProxyRuntime(config) {
|
|
224
|
+
return new AxtaryProxyRuntime(config);
|
|
225
|
+
}
|
|
226
|
+
function proxyDeny(reasons, previousDecision) {
|
|
227
|
+
return {
|
|
228
|
+
decision: "deny",
|
|
229
|
+
reasons,
|
|
230
|
+
policy: {
|
|
231
|
+
nativeRule: "axtary_proxy_v0",
|
|
232
|
+
version: PROXY_POLICY_VERSION,
|
|
233
|
+
cedarCompatible: true,
|
|
234
|
+
opaCompatible: true,
|
|
235
|
+
},
|
|
236
|
+
constraints: {
|
|
237
|
+
expiresInSeconds: previousDecision?.constraints.expiresInSeconds ?? DEFAULT_EXPIRES_IN_SECONDS,
|
|
238
|
+
maxFilesChanged: previousDecision?.constraints.maxFilesChanged ?? 0,
|
|
239
|
+
blockedPaths: previousDecision?.constraints.blockedPaths ?? [],
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function normalizeApprovalResult(result) {
|
|
244
|
+
if (!result) {
|
|
245
|
+
return {};
|
|
246
|
+
}
|
|
247
|
+
if ("schemaVersion" in result && result.schemaVersion === APPROVAL_ARTIFACT_VERSION) {
|
|
248
|
+
return {
|
|
249
|
+
approvalArtifact: result,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
if ("mode" in result) {
|
|
253
|
+
return {
|
|
254
|
+
approval: result,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
approval: result.approval,
|
|
259
|
+
approvalArtifact: result.approvalArtifact,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function approveStepUp(decision) {
|
|
263
|
+
return {
|
|
264
|
+
...decision,
|
|
265
|
+
decision: "allow",
|
|
266
|
+
reasons: [...decision.reasons, "step_up_approved"],
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
function errorToReason(error) {
|
|
270
|
+
return error instanceof Error ? error.message : "unknown_error";
|
|
271
|
+
}
|
|
272
|
+
function createTimings() {
|
|
273
|
+
return {
|
|
274
|
+
totalMs: 0,
|
|
275
|
+
parseMs: 0,
|
|
276
|
+
policyMs: 0,
|
|
277
|
+
actionPassMs: 0,
|
|
278
|
+
ledgerMs: 0,
|
|
279
|
+
approvalMs: 0,
|
|
280
|
+
handlerMs: 0,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function elapsed(startedAt) {
|
|
284
|
+
return Math.round((performance.now() - startedAt) * 1000) / 1000;
|
|
285
|
+
}
|
|
286
|
+
function withTimeout(value, timeoutMs) {
|
|
287
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
288
|
+
return Promise.resolve(value);
|
|
289
|
+
}
|
|
290
|
+
return new Promise((resolve, reject) => {
|
|
291
|
+
const timeout = setTimeout(() => {
|
|
292
|
+
reject(new Error(`proxy_handler_timeout:${timeoutMs}ms`));
|
|
293
|
+
}, timeoutMs);
|
|
294
|
+
void Promise.resolve(value).then((result) => {
|
|
295
|
+
clearTimeout(timeout);
|
|
296
|
+
resolve(result);
|
|
297
|
+
}, (error) => {
|
|
298
|
+
clearTimeout(timeout);
|
|
299
|
+
reject(error);
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+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AiB;IAEjB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,IAAI,CAAC,EAAE,CAAC;QAClD,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC9B,MAAM,CAAC,IAAI,KAAK,CAAC,yBAAyB,SAAS,IAAI,CAAC,CAAC,CAAC;QAC5D,CAAC,EAAE,SAAS,CAAC,CAAC;QAEd,KAAK,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAC9B,CAAC,MAAM,EAAE,EAAE;YACT,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,EACD,CAAC,KAAK,EAAE,EAAE;YACR,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@axtary/proxy",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Local fail-closed runtime proxy for Axtary policy, ActionPass issuance, and ledger recording.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "UNLICENSED",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/axtary/axtary.git",
|
|
11
|
+
"directory": "packages/proxy"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"ai-agents",
|
|
15
|
+
"authorization",
|
|
16
|
+
"runtime-security",
|
|
17
|
+
"proxy",
|
|
18
|
+
"mcp"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": "^20.19.0 || ^22.13.0 || >=24"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"prebuild": "npm run build -w @axtary/actionpass && npm run build -w @axtary/policy && npm run build -w @axtary/ledger",
|
|
25
|
+
"build": "npm run clean && tsc -p tsconfig.json",
|
|
26
|
+
"clean": "rm -rf dist",
|
|
27
|
+
"prepack": "npm run build"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"README.md",
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"main": "./dist/index.js",
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"import": "./dist/index.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"types": "./dist/index.d.ts",
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@axtary/actionpass": "0.0.1",
|
|
46
|
+
"@axtary/ledger": "0.0.1",
|
|
47
|
+
"@axtary/policy": "0.0.1"
|
|
48
|
+
}
|
|
49
|
+
}
|