@aionis/sdk 0.1.2 → 0.1.7
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 +176 -3
- package/dist/index.d.ts +357 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +682 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,10 +8,15 @@ npm install @aionis/sdk
|
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
10
|
import {
|
|
11
|
-
|
|
11
|
+
compileExecutionAgentContext,
|
|
12
|
+
commandPostureFromGuide,
|
|
12
13
|
createAionisClient,
|
|
13
14
|
feedbackFromGuide,
|
|
15
|
+
memoryAdmissionDatasetJsonlFromGuide,
|
|
16
|
+
memoryAdmissionRecordFromGuide,
|
|
14
17
|
measureInputFromGuideLoop,
|
|
18
|
+
mustNotMemoryIdsFromGuide,
|
|
19
|
+
shouldContinueMemoryIdsFromGuide,
|
|
15
20
|
snapshotInputFromGuideLoop,
|
|
16
21
|
} from "@aionis/sdk";
|
|
17
22
|
|
|
@@ -29,7 +34,20 @@ const guide = await aionis.guide({
|
|
|
29
34
|
include_packets: true,
|
|
30
35
|
});
|
|
31
36
|
|
|
32
|
-
const
|
|
37
|
+
const context = compileExecutionAgentContext({
|
|
38
|
+
guide,
|
|
39
|
+
task: "Continue the task.",
|
|
40
|
+
budget_profile: "balanced",
|
|
41
|
+
});
|
|
42
|
+
const agentPrompt = context.agent_prompt;
|
|
43
|
+
const commandPosture = commandPostureFromGuide(guide);
|
|
44
|
+
const mustNotMemoryIds = mustNotMemoryIdsFromGuide(guide);
|
|
45
|
+
const shouldContinueMemoryIds = shouldContinueMemoryIdsFromGuide(guide);
|
|
46
|
+
const admissionRecord = memoryAdmissionRecordFromGuide(guide);
|
|
47
|
+
const admissionDatasetJsonl = memoryAdmissionDatasetJsonlFromGuide(guide, {
|
|
48
|
+
run_id: "run-001",
|
|
49
|
+
task_signature: "first-integration",
|
|
50
|
+
});
|
|
33
51
|
|
|
34
52
|
const feedback = await aionis.feedback(feedbackFromGuide({
|
|
35
53
|
guide,
|
|
@@ -59,7 +77,31 @@ await aionis.snapshot(snapshotInputFromGuideLoop({
|
|
|
59
77
|
```
|
|
60
78
|
|
|
61
79
|
Only pass `agentPrompt` or selected `agent_context` fields to your Agent. Keep
|
|
62
|
-
packets, traces, receipts, raw slots, and operator snapshots
|
|
80
|
+
packets, traces, receipts, admission records, raw slots, and operator snapshots
|
|
81
|
+
in host logs.
|
|
82
|
+
Use `commandPostureFromGuide()` when the host wants structured execution
|
|
83
|
+
instructions: `must_not` blocks failed or stale branches, `should_continue`
|
|
84
|
+
biases the Agent toward active state or accepted procedure, `inspect_first`
|
|
85
|
+
keeps candidate history out of direct action, and `rehydrate_first` asks the
|
|
86
|
+
host to recover raw payload before exact use.
|
|
87
|
+
|
|
88
|
+
For token-sensitive Agent calls, request compact prompt rendering:
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
const compactGuide = await aionis.guide({
|
|
92
|
+
query_text: "Continue the task without repeating failed work.",
|
|
93
|
+
consumer_agent_id: "agent-1",
|
|
94
|
+
context_mode: "compact_agent",
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const compactPrompt = compileExecutionAgentContext({
|
|
98
|
+
guide: compactGuide,
|
|
99
|
+
budget_profile: "compact",
|
|
100
|
+
}).agent_prompt;
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`context_mode: "compact_agent"` keeps SDK guide defaults on the governed
|
|
104
|
+
full-power path while shortening only `agent_context.prompt_text`.
|
|
63
105
|
|
|
64
106
|
## Execution Memory Helpers
|
|
65
107
|
|
|
@@ -84,8 +126,23 @@ const guide = await aionis.execution.guideForRole({
|
|
|
84
126
|
run_id: "run-001",
|
|
85
127
|
task_signature: "checkout-migration",
|
|
86
128
|
query_text: "Continue from the current verified execution path.",
|
|
129
|
+
context_mode: "compact_agent",
|
|
87
130
|
});
|
|
88
131
|
|
|
132
|
+
const context = compileExecutionAgentContext({
|
|
133
|
+
guide,
|
|
134
|
+
task: {
|
|
135
|
+
task_signature: "checkout-migration",
|
|
136
|
+
query_text: "Continue from the current verified execution path.",
|
|
137
|
+
},
|
|
138
|
+
repo_state: {
|
|
139
|
+
existing_files: ["src/checkout.ts"],
|
|
140
|
+
},
|
|
141
|
+
budget_profile: "balanced",
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// Your host runs the Agent with context.agent_prompt.
|
|
145
|
+
|
|
89
146
|
const feedback = await aionis.execution.feedbackFromOutcome({
|
|
90
147
|
agent_id: "reviewer-1",
|
|
91
148
|
run_id: "run-001",
|
|
@@ -97,3 +154,119 @@ const feedback = await aionis.execution.feedbackFromOutcome({
|
|
|
97
154
|
used_memory_ids: guide.agent_context.use_now_memory_ids.slice(0, 1),
|
|
98
155
|
});
|
|
99
156
|
```
|
|
157
|
+
|
|
158
|
+
`compileExecutionAgentContext` is the recommended product path for coding and
|
|
159
|
+
multi-agent hosts. It converts the governed Runtime `guide` into a contract
|
|
160
|
+
prompt plus structured adapter state:
|
|
161
|
+
|
|
162
|
+
- active route targets and pending artifacts
|
|
163
|
+
- reference-only and blocked direction targets
|
|
164
|
+
- `use_now`, `inspect_before_use`, `do_not_use`, and `rehydrate` memory IDs
|
|
165
|
+
- a compact Memory Use Receipt for audit and feedback attribution
|
|
166
|
+
- a Memory Admission Record for per-memory admission dataset rows
|
|
167
|
+
- warnings when a host-observed active target is missing
|
|
168
|
+
|
|
169
|
+
This helper does not mutate Runtime state and does not expose raw packets to the
|
|
170
|
+
Agent. If an active target is missing, the rendered contract tells the Agent to
|
|
171
|
+
treat the target as pending work instead of falling back to a blocked or
|
|
172
|
+
reference-only path that happens to exist.
|
|
173
|
+
|
|
174
|
+
For a host loop, the most common posture helpers are:
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
const mustNot = mustNotMemoryIdsFromGuide(guide);
|
|
178
|
+
const shouldContinue = shouldContinueMemoryIdsFromGuide(guide);
|
|
179
|
+
const posture = commandPostureFromGuide(guide);
|
|
180
|
+
const route = routeContractFromGuide(guide);
|
|
181
|
+
const evidence = evidenceSourcesFromGuide(guide);
|
|
182
|
+
const blocked = blockedRoutesFromGuide(guide);
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
These helpers read only `agent_context`. They do not expose `memory_packet`,
|
|
186
|
+
`guide_packet`, traces, or operator-only evidence to the Agent.
|
|
187
|
+
`routeContractFromGuide` exposes the structured execution contract:
|
|
188
|
+
`active_targets` are the continuation route, `pending_artifacts` describe
|
|
189
|
+
missing-active-target handling, `evidence_sources` are reference-only evidence,
|
|
190
|
+
and `blocked_routes` are counter-evidence only.
|
|
191
|
+
|
|
192
|
+
`memoryAdmissionRecordFromGuide(guide)` is the host/operator surface for the
|
|
193
|
+
read-only admission ledger. It records candidate memory IDs, admission actions,
|
|
194
|
+
prompt exposure, and feedback attribution without changing Runtime authority or
|
|
195
|
+
adding content to the Agent prompt.
|
|
196
|
+
|
|
197
|
+
`memoryAdmissionDatasetJsonlFromGuide(guide)` exports that ledger as JSONL rows
|
|
198
|
+
for host logs or a data lake. It keeps raw prompt text, raw memory payloads, and
|
|
199
|
+
embeddings out of the export while preserving enough admission/outcome fields to
|
|
200
|
+
audit decisions or train a future admission policy offline.
|
|
201
|
+
|
|
202
|
+
## Govern External Memory
|
|
203
|
+
|
|
204
|
+
Use `governMemory()` when your host already has candidates from Mem0, Zep,
|
|
205
|
+
Pinecone, pgvector, markdown, logs, or another memory backend, but still wants
|
|
206
|
+
Aionis to decide which memory may direct the Agent.
|
|
207
|
+
|
|
208
|
+
```ts
|
|
209
|
+
const result = await aionis.governMemory({
|
|
210
|
+
query_text: "Continue the checkout migration without reusing failed branches.",
|
|
211
|
+
mode: "firewall",
|
|
212
|
+
include_records: true,
|
|
213
|
+
candidates: [
|
|
214
|
+
{
|
|
215
|
+
external_memory_id: "mem0:current-route",
|
|
216
|
+
source_backend: "mem0",
|
|
217
|
+
text: "Current accepted target is packages/api/src/checkout.ts.",
|
|
218
|
+
authority: {
|
|
219
|
+
source_trust: "trusted",
|
|
220
|
+
scope: "project",
|
|
221
|
+
evidence_requirement: "none",
|
|
222
|
+
},
|
|
223
|
+
lifecycle_hint: "current",
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
external_memory_id: "zep:failed-route",
|
|
227
|
+
source_backend: "zep",
|
|
228
|
+
text: "The legacy route failed verifier checks.",
|
|
229
|
+
authority: {
|
|
230
|
+
source_trust: "trusted",
|
|
231
|
+
scope: "project",
|
|
232
|
+
evidence_requirement: "none",
|
|
233
|
+
},
|
|
234
|
+
lifecycle_hint: "failed",
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
const prompt = result.agent_context.prompt_text;
|
|
240
|
+
const firewall = result.memory_firewall;
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
`mode: "firewall"` blocks failed, stale, contested, suppressed, archived, or
|
|
244
|
+
policy-blocked external memory from direct action. Unknown or untrusted memory
|
|
245
|
+
stays `inspect_before_use`; raw evidence pointers stay `rehydrate`.
|
|
246
|
+
|
|
247
|
+
## Replay Agent Decisions
|
|
248
|
+
|
|
249
|
+
Use `flightRecorder()` after a run to inspect what memory the Agent was allowed
|
|
250
|
+
to see at decision time.
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
const replay = await aionis.flightRecorder({
|
|
254
|
+
run_id: "run-001",
|
|
255
|
+
guide_trace_id: guide.guide_trace_id,
|
|
256
|
+
product_trace: {
|
|
257
|
+
before_guide: previousGuide,
|
|
258
|
+
after_guide: guide,
|
|
259
|
+
},
|
|
260
|
+
feedback_result: {
|
|
261
|
+
run_id: "run-001",
|
|
262
|
+
outcome: "positive",
|
|
263
|
+
used_memory_ids: guide.agent_context.use_now_memory_ids.slice(0, 1),
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
console.log(replay.agent_flight_recorder.agent_view.use_now_memory_ids);
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
The report excludes `agent_context.prompt_text` and raw memory payloads. Keep it
|
|
271
|
+
in host/operator logs for incident replay, support debugging, and memory-quality
|
|
272
|
+
review.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type AionisJsonObject = Record<string, unknown>;
|
|
2
2
|
export type AionisGuideMode = "standard" | "full_power";
|
|
3
|
+
export type AionisGuideContextMode = AionisGuideMode | "compact_agent";
|
|
3
4
|
export type AionisFeedbackOutcome = "positive" | "negative" | "neutral";
|
|
4
5
|
export type AionisFeedbackUsedSurface = "use_now" | "inspect_before_use" | "do_not_use" | "explicit_host_assertion";
|
|
5
6
|
export type AionisFeedbackStatus = "passed" | "failed" | "not_run" | "unknown";
|
|
@@ -13,6 +14,332 @@ export type AionisRememberTier = "hot" | "warm" | "cold" | "archive";
|
|
|
13
14
|
export type AionisExecutionAgentRole = "agent" | "planner" | "worker" | "verifier" | "reviewer";
|
|
14
15
|
export type AionisExecutionOutcomeStatus = "succeeded" | "failed" | "blocked" | "interrupted" | "unknown";
|
|
15
16
|
export type AionisHandoffKind = "patch_handoff" | "review_handoff" | "task_handoff";
|
|
17
|
+
export type AionisCommandPostureKind = "must_not" | "should_continue" | "inspect_first" | "rehydrate_first" | "optional_context";
|
|
18
|
+
export type AionisCommandPostureSurface = "current" | "procedure" | "use_now" | "inspect_before_use" | "do_not_use" | "rehydrate" | "context";
|
|
19
|
+
export type AionisCommandPosture = {
|
|
20
|
+
posture: AionisCommandPostureKind;
|
|
21
|
+
surface: AionisCommandPostureSurface;
|
|
22
|
+
memory_id: string;
|
|
23
|
+
instruction: string;
|
|
24
|
+
reason: string;
|
|
25
|
+
target_files: string[];
|
|
26
|
+
};
|
|
27
|
+
export type AionisRouteContractSource = "target_files" | "should_continue" | "inspect_first" | "must_not";
|
|
28
|
+
export type AionisRouteContractTarget = {
|
|
29
|
+
target: string;
|
|
30
|
+
source_memory_id?: string;
|
|
31
|
+
source: AionisRouteContractSource;
|
|
32
|
+
reason?: string;
|
|
33
|
+
};
|
|
34
|
+
export type AionisRouteContractActiveTarget = AionisRouteContractTarget & {
|
|
35
|
+
artifact_status: "unknown" | "may_be_absent";
|
|
36
|
+
missing_policy: "restore_or_create_if_task_consistent_or_rehydrate";
|
|
37
|
+
};
|
|
38
|
+
export type AionisRouteContractMissingActiveAction = "create" | "restore" | "rehydrate" | "report_conflict";
|
|
39
|
+
export type AionisRouteContractPendingArtifact = AionisRouteContractTarget & {
|
|
40
|
+
status: "unknown_until_host_observation";
|
|
41
|
+
when: "if_active_target_is_missing";
|
|
42
|
+
allowed_actions: AionisRouteContractMissingActiveAction[];
|
|
43
|
+
preferred_action_order: AionisRouteContractMissingActiveAction[];
|
|
44
|
+
terminal_inspect_allowed: false;
|
|
45
|
+
};
|
|
46
|
+
export type AionisRouteContractEvidenceSource = AionisRouteContractTarget & {
|
|
47
|
+
evidence_use: "reference_only";
|
|
48
|
+
direction_policy: "must_not_be_primary_route";
|
|
49
|
+
};
|
|
50
|
+
export type AionisRouteContractBlockedRoute = AionisRouteContractTarget & {
|
|
51
|
+
direction_policy: "blocked_route";
|
|
52
|
+
evidence_use: "counter_evidence_only";
|
|
53
|
+
};
|
|
54
|
+
export type AionisRouteContractActionPolicy = {
|
|
55
|
+
missing_active_target_preferred_order: AionisRouteContractMissingActiveAction[];
|
|
56
|
+
terminal_inspect_allowed: false;
|
|
57
|
+
reference_fallback_requires: "explicit_raw_evidence_or_operator_confirmation";
|
|
58
|
+
};
|
|
59
|
+
export type AionisRouteContract = {
|
|
60
|
+
active_targets: AionisRouteContractActiveTarget[];
|
|
61
|
+
pending_artifacts: AionisRouteContractPendingArtifact[];
|
|
62
|
+
reference_only_targets: AionisRouteContractTarget[];
|
|
63
|
+
blocked_direction_targets: AionisRouteContractTarget[];
|
|
64
|
+
evidence_sources: AionisRouteContractEvidenceSource[];
|
|
65
|
+
blocked_routes: AionisRouteContractBlockedRoute[];
|
|
66
|
+
conflict_policy: "do_not_treat_missing_active_target_as_superseded";
|
|
67
|
+
fallback_policy: "do_not_promote_reference_or_blocked_targets";
|
|
68
|
+
action_policy: AionisRouteContractActionPolicy;
|
|
69
|
+
};
|
|
70
|
+
export type AionisRehydrateHint = {
|
|
71
|
+
memory_id: string;
|
|
72
|
+
reason?: string;
|
|
73
|
+
required: boolean;
|
|
74
|
+
};
|
|
75
|
+
export type AionisMemoryDecisionSummary = {
|
|
76
|
+
memory_id: string;
|
|
77
|
+
agent_surface: "use_now" | "inspect_before_use" | "do_not_use" | "rehydrate" | "not_agent_facing";
|
|
78
|
+
decision_kind: "used" | "downgraded" | "blocked" | "rehydrate" | "not_agent_facing";
|
|
79
|
+
actionable: boolean;
|
|
80
|
+
reason_codes: string[];
|
|
81
|
+
};
|
|
82
|
+
export type AionisMemoryUseReceipt = {
|
|
83
|
+
contract_version: "aionis_memory_use_receipt_v1";
|
|
84
|
+
intended_use: "memory_use_audit";
|
|
85
|
+
agent_prompt_included: false;
|
|
86
|
+
runtime_mutation: false;
|
|
87
|
+
guide_trace_id: string | null;
|
|
88
|
+
history_used: boolean;
|
|
89
|
+
actionable_history_used: boolean;
|
|
90
|
+
prompt_char_count: number;
|
|
91
|
+
exposed_memory_ids: string[];
|
|
92
|
+
use_now_memory_ids: string[];
|
|
93
|
+
inspect_before_use_memory_ids: string[];
|
|
94
|
+
do_not_use_memory_ids: string[];
|
|
95
|
+
rehydrate_memory_ids: string[];
|
|
96
|
+
attributed_memory_ids: string[];
|
|
97
|
+
unattributed_recalled_memory_ids: string[];
|
|
98
|
+
read_only_signal_memory_ids: string[];
|
|
99
|
+
decision_summaries: AionisMemoryDecisionSummary[];
|
|
100
|
+
risk_flags: string[];
|
|
101
|
+
summary: string;
|
|
102
|
+
};
|
|
103
|
+
export type AionisMemoryAdmissionRecordEntry = {
|
|
104
|
+
memory_id: string;
|
|
105
|
+
title: string | null;
|
|
106
|
+
memory_origin?: "aionis" | "external";
|
|
107
|
+
source_backend?: string;
|
|
108
|
+
domain: "general" | "execution";
|
|
109
|
+
memory_type: "fact" | "preference" | "project_context" | "procedure" | "event" | "evidence" | "rule" | "execution_memory" | "unknown";
|
|
110
|
+
lifecycle_state: "active" | "candidate" | "contested" | "suppressed" | "demoted" | "archived" | "rehydration_candidate" | "unknown";
|
|
111
|
+
authority: "none" | "advisory" | "trusted" | "blocked";
|
|
112
|
+
admission_action: "use_now" | "inspect_before_use" | "do_not_use" | "rehydrate" | "not_agent_facing";
|
|
113
|
+
decision_kind: "used" | "downgraded" | "blocked" | "rehydrate" | "not_agent_facing";
|
|
114
|
+
actionable: boolean;
|
|
115
|
+
prompt_included: boolean;
|
|
116
|
+
agent_used: boolean;
|
|
117
|
+
feedback_outcome: AionisFeedbackOutcome | null;
|
|
118
|
+
attribution_strength: "none" | "observed_feedback_only" | "positive_attribution" | "weak_below_threshold" | "repeated_weak_threshold_met" | "strong_signal_threshold_met" | null;
|
|
119
|
+
reason_codes: string[];
|
|
120
|
+
evidence_ids: string[];
|
|
121
|
+
};
|
|
122
|
+
export type AionisMemoryAdmissionRecord = {
|
|
123
|
+
contract_version: "aionis_memory_admission_record_v1";
|
|
124
|
+
intended_use: "memory_admission_audit_dataset";
|
|
125
|
+
source: "memory_decision_trace" | "external_candidate_admission";
|
|
126
|
+
agent_prompt_included: false;
|
|
127
|
+
runtime_mutation: false;
|
|
128
|
+
tenant_id?: string;
|
|
129
|
+
scope?: string;
|
|
130
|
+
guide_trace_id: string | null;
|
|
131
|
+
prompt_char_count: number;
|
|
132
|
+
history_used: boolean;
|
|
133
|
+
actionable_history_used: boolean;
|
|
134
|
+
candidate_memory_count: number;
|
|
135
|
+
prompt_included_memory_count: number;
|
|
136
|
+
agent_used_memory_count: number;
|
|
137
|
+
entries: AionisMemoryAdmissionRecordEntry[];
|
|
138
|
+
summary: string;
|
|
139
|
+
};
|
|
140
|
+
export type AionisExternalMemoryAuthority = {
|
|
141
|
+
source_trust?: "trusted" | "known" | "untrusted" | "unknown";
|
|
142
|
+
scope?: "user" | "project" | "team" | "org" | "global" | "unknown";
|
|
143
|
+
evidence_requirement?: "none" | "inspect_before_use" | "rehydrate_before_use" | "blocked";
|
|
144
|
+
};
|
|
145
|
+
export type AionisExternalMemoryLifecycleHint = "current" | "procedure" | "failed" | "stale" | "contested" | "suppressed" | "archived" | "unknown";
|
|
146
|
+
export type AionisExternalMemoryCandidate = {
|
|
147
|
+
external_memory_id: string;
|
|
148
|
+
source_backend: string;
|
|
149
|
+
text: string;
|
|
150
|
+
metadata?: AionisJsonObject;
|
|
151
|
+
authority?: AionisExternalMemoryAuthority;
|
|
152
|
+
lifecycle_hint?: AionisExternalMemoryLifecycleHint;
|
|
153
|
+
evidence_refs?: string[];
|
|
154
|
+
};
|
|
155
|
+
export type AionisMemoryAdmissionGatewayMode = "standard" | "strict" | "firewall";
|
|
156
|
+
export type AionisMemoryAdmissionRequest = AionisJsonObject & {
|
|
157
|
+
query_text: string;
|
|
158
|
+
run_id?: string;
|
|
159
|
+
mode?: AionisMemoryAdmissionGatewayMode;
|
|
160
|
+
context_mode?: "standard" | "compact_agent";
|
|
161
|
+
candidates: AionisExternalMemoryCandidate[];
|
|
162
|
+
include_records?: boolean;
|
|
163
|
+
};
|
|
164
|
+
export type AionisMemoryFirewallSummary = {
|
|
165
|
+
contract_version: "aionis_memory_firewall_summary_v1";
|
|
166
|
+
intended_use: "memory_firewall_audit";
|
|
167
|
+
mode: "firewall";
|
|
168
|
+
candidate_count: number;
|
|
169
|
+
direct_use_count: number;
|
|
170
|
+
inspect_count: number;
|
|
171
|
+
blocked_count: number;
|
|
172
|
+
rehydrate_count: number;
|
|
173
|
+
unsafe_candidate_count: number;
|
|
174
|
+
unsafe_direct_use_count: number;
|
|
175
|
+
runtime_mutation: false;
|
|
176
|
+
agent_prompt_included: false;
|
|
177
|
+
risk_flags: string[];
|
|
178
|
+
claims: Array<{
|
|
179
|
+
claim: string;
|
|
180
|
+
status: "pass" | "warn" | "fail";
|
|
181
|
+
evidence: string;
|
|
182
|
+
}>;
|
|
183
|
+
summary: string;
|
|
184
|
+
};
|
|
185
|
+
export type AionisMemoryAdmissionGatewayResponse = AionisJsonObject & {
|
|
186
|
+
contract_version: "aionis_memory_admission_gateway_result_v1";
|
|
187
|
+
tenant_id: string;
|
|
188
|
+
scope: string;
|
|
189
|
+
run_id: string | null;
|
|
190
|
+
mode: AionisMemoryAdmissionGatewayMode;
|
|
191
|
+
agent_context: AionisJsonObject;
|
|
192
|
+
memory_use_receipt: AionisMemoryUseReceipt;
|
|
193
|
+
memory_admission_records?: AionisMemoryAdmissionRecord;
|
|
194
|
+
memory_firewall?: AionisMemoryFirewallSummary;
|
|
195
|
+
admission_summary: AionisJsonObject;
|
|
196
|
+
source_map: AionisJsonObject;
|
|
197
|
+
};
|
|
198
|
+
export type AionisAgentFlightRecorderReport = AionisJsonObject & {
|
|
199
|
+
contract_version: "aionis_agent_flight_recorder_report_v1";
|
|
200
|
+
intended_use: "incident_replay_audit";
|
|
201
|
+
agent_prompt_included: false;
|
|
202
|
+
runtime_mutation: false;
|
|
203
|
+
guide_trace_id: string | null;
|
|
204
|
+
run_id: string | null;
|
|
205
|
+
decision_time: string;
|
|
206
|
+
agent_view: AionisJsonObject & {
|
|
207
|
+
prompt_text_included: false;
|
|
208
|
+
exposed_memory_ids: string[];
|
|
209
|
+
use_now_memory_ids: string[];
|
|
210
|
+
inspect_before_use_memory_ids: string[];
|
|
211
|
+
do_not_use_memory_ids: string[];
|
|
212
|
+
rehydrate_memory_ids: string[];
|
|
213
|
+
};
|
|
214
|
+
blocked_or_suppressed: AionisJsonObject[];
|
|
215
|
+
attribution: AionisJsonObject & {
|
|
216
|
+
present: boolean;
|
|
217
|
+
outcome: AionisFeedbackOutcome | null;
|
|
218
|
+
used_memory_ids: string[];
|
|
219
|
+
attributed_memory_ids: string[];
|
|
220
|
+
unattributed_memory_ids: string[];
|
|
221
|
+
supported_memory_ids: string[];
|
|
222
|
+
contradicted_memory_ids: string[];
|
|
223
|
+
};
|
|
224
|
+
replay_sources: AionisJsonObject;
|
|
225
|
+
claims: AionisJsonObject[];
|
|
226
|
+
source_map: AionisJsonObject;
|
|
227
|
+
summary: string;
|
|
228
|
+
};
|
|
229
|
+
export type AionisAgentFlightRecorderRequest = AionisJsonObject & {
|
|
230
|
+
guide_trace_id?: string;
|
|
231
|
+
run_id?: string;
|
|
232
|
+
product_trace?: AionisJsonObject;
|
|
233
|
+
agent_context?: AionisJsonObject;
|
|
234
|
+
memory_decision_trace?: AionisJsonObject;
|
|
235
|
+
memory_use_receipt?: AionisJsonObject;
|
|
236
|
+
memory_admission_record?: AionisJsonObject;
|
|
237
|
+
operator_snapshot?: AionisJsonObject;
|
|
238
|
+
feedback_result?: AionisJsonObject;
|
|
239
|
+
decision_time?: string;
|
|
240
|
+
};
|
|
241
|
+
export type AionisAgentFlightRecorderResponse = AionisJsonObject & {
|
|
242
|
+
contract_version: "aionis_agent_flight_recorder_result_v1";
|
|
243
|
+
tenant_id: string;
|
|
244
|
+
scope: string;
|
|
245
|
+
agent_flight_recorder: AionisAgentFlightRecorderReport;
|
|
246
|
+
source_map: AionisJsonObject;
|
|
247
|
+
};
|
|
248
|
+
export type AionisMemoryAdmissionDatasetOutcomeLabel = "positive_use" | "negative_use" | "neutral_use" | "unused_exposed" | "blocked_or_suppressed" | "rehydrate_requested" | "not_agent_facing" | "unknown";
|
|
249
|
+
export type AionisMemoryAdmissionDatasetRow = {
|
|
250
|
+
contract_version: "aionis_memory_admission_dataset_row_v1";
|
|
251
|
+
intended_use: "memory_admission_policy_training_or_audit";
|
|
252
|
+
source: "memory_admission_record";
|
|
253
|
+
agent_prompt_included: false;
|
|
254
|
+
runtime_mutation: false;
|
|
255
|
+
tenant_id: string | null;
|
|
256
|
+
scope: string | null;
|
|
257
|
+
guide_trace_id: string | null;
|
|
258
|
+
run_id: string | null;
|
|
259
|
+
task_id: string | null;
|
|
260
|
+
task_signature: string | null;
|
|
261
|
+
row_index: number;
|
|
262
|
+
memory_id: string;
|
|
263
|
+
title: string | null;
|
|
264
|
+
memory_origin: AionisMemoryAdmissionRecordEntry["memory_origin"];
|
|
265
|
+
source_backend: string | null;
|
|
266
|
+
domain: AionisMemoryAdmissionRecordEntry["domain"];
|
|
267
|
+
memory_type: AionisMemoryAdmissionRecordEntry["memory_type"];
|
|
268
|
+
lifecycle_state: AionisMemoryAdmissionRecordEntry["lifecycle_state"];
|
|
269
|
+
authority: AionisMemoryAdmissionRecordEntry["authority"];
|
|
270
|
+
admission_action: AionisMemoryAdmissionRecordEntry["admission_action"];
|
|
271
|
+
decision_kind: AionisMemoryAdmissionRecordEntry["decision_kind"];
|
|
272
|
+
actionable: boolean;
|
|
273
|
+
prompt_included: boolean;
|
|
274
|
+
agent_used: boolean;
|
|
275
|
+
feedback_outcome: AionisFeedbackOutcome | null;
|
|
276
|
+
attribution_strength: AionisMemoryAdmissionRecordEntry["attribution_strength"];
|
|
277
|
+
outcome_label: AionisMemoryAdmissionDatasetOutcomeLabel;
|
|
278
|
+
reason_codes: string[];
|
|
279
|
+
evidence_ids: string[];
|
|
280
|
+
prompt_char_count: number;
|
|
281
|
+
history_used: boolean;
|
|
282
|
+
actionable_history_used: boolean;
|
|
283
|
+
};
|
|
284
|
+
export type AionisMemoryAdmissionDatasetExportOptions = {
|
|
285
|
+
run_id?: string | null;
|
|
286
|
+
task_id?: string | null;
|
|
287
|
+
task_signature?: string | null;
|
|
288
|
+
};
|
|
289
|
+
export type AionisExecutionContextBudgetProfile = "compact" | "balanced" | "high_recall";
|
|
290
|
+
export type AionisExecutionFilePresence = {
|
|
291
|
+
target: string;
|
|
292
|
+
exists: boolean;
|
|
293
|
+
reason?: string;
|
|
294
|
+
};
|
|
295
|
+
export type AionisExecutionRepoState = {
|
|
296
|
+
existing_files?: string[];
|
|
297
|
+
missing_files?: string[];
|
|
298
|
+
files?: AionisExecutionFilePresence[];
|
|
299
|
+
};
|
|
300
|
+
export type AionisExecutionContextTask = {
|
|
301
|
+
task_id?: string;
|
|
302
|
+
run_id?: string;
|
|
303
|
+
task_signature?: string;
|
|
304
|
+
query_text?: string;
|
|
305
|
+
goal?: string;
|
|
306
|
+
};
|
|
307
|
+
export type AionisExecutionAgentContextCompileInput = {
|
|
308
|
+
guide: unknown;
|
|
309
|
+
task?: string | AionisExecutionContextTask;
|
|
310
|
+
repo_state?: AionisExecutionRepoState;
|
|
311
|
+
budget_profile?: AionisExecutionContextBudgetProfile;
|
|
312
|
+
max_prompt_chars?: number;
|
|
313
|
+
include_base_prompt?: boolean;
|
|
314
|
+
additional_instructions?: string[];
|
|
315
|
+
};
|
|
316
|
+
export type AionisExecutionContextWarning = {
|
|
317
|
+
code: "missing_active_target" | "blocked_route_present" | "reference_only_target_present" | "rehydrate_recommended";
|
|
318
|
+
message: string;
|
|
319
|
+
targets?: string[];
|
|
320
|
+
memory_ids?: string[];
|
|
321
|
+
};
|
|
322
|
+
export type AionisCompiledExecutionAgentContext = {
|
|
323
|
+
contract_version: "aionis_execution_agent_context_v1";
|
|
324
|
+
budget_profile: AionisExecutionContextBudgetProfile;
|
|
325
|
+
agent_prompt: string;
|
|
326
|
+
base_prompt: string;
|
|
327
|
+
prompt_char_count: number;
|
|
328
|
+
route_contract: AionisRouteContract | null;
|
|
329
|
+
command_posture: AionisCommandPosture[];
|
|
330
|
+
memory_use_receipt: AionisMemoryUseReceipt;
|
|
331
|
+
memory_admission_record: AionisMemoryAdmissionRecord;
|
|
332
|
+
rehydrate_requests: AionisRehydrateHint[];
|
|
333
|
+
use_now_memory_ids: string[];
|
|
334
|
+
inspect_before_use_memory_ids: string[];
|
|
335
|
+
do_not_use_memory_ids: string[];
|
|
336
|
+
active_targets: string[];
|
|
337
|
+
missing_active_targets: string[];
|
|
338
|
+
pending_artifacts: string[];
|
|
339
|
+
reference_only_targets: string[];
|
|
340
|
+
blocked_direction_targets: string[];
|
|
341
|
+
execution_warnings: AionisExecutionContextWarning[];
|
|
342
|
+
};
|
|
16
343
|
export type AionisClientOptions = {
|
|
17
344
|
baseUrl: string;
|
|
18
345
|
apiKey?: string;
|
|
@@ -191,7 +518,7 @@ export type AionisExecutionGuideForRoleInput = AionisExecutionRunRef & AionisExe
|
|
|
191
518
|
limit?: number;
|
|
192
519
|
include_packets?: boolean;
|
|
193
520
|
mode?: AionisGuideMode;
|
|
194
|
-
context_mode?:
|
|
521
|
+
context_mode?: AionisGuideContextMode;
|
|
195
522
|
context_char_budget?: number;
|
|
196
523
|
context_token_budget?: number;
|
|
197
524
|
context_compaction_profile?: "balanced" | "aggressive";
|
|
@@ -251,11 +578,13 @@ export declare class AionisClient {
|
|
|
251
578
|
observe<T = unknown>(body: AionisJsonObject, options?: AionisRequestOptions): Promise<T>;
|
|
252
579
|
remember<T = unknown>(body: AionisRememberRequest, options?: AionisRequestOptions): Promise<T>;
|
|
253
580
|
guide<T = unknown>(body: AionisJsonObject, options?: AionisGuideRequestOptions): Promise<T>;
|
|
581
|
+
governMemory<T = AionisMemoryAdmissionGatewayResponse>(body: AionisMemoryAdmissionRequest, options?: AionisRequestOptions): Promise<T>;
|
|
254
582
|
forget<T = unknown>(body: AionisJsonObject, options?: AionisRequestOptions): Promise<T>;
|
|
255
583
|
feedback<T = unknown>(body: AionisFeedbackRequest, options?: AionisRequestOptions): Promise<T>;
|
|
256
584
|
rehydrate<T = unknown>(body: AionisRehydrateRequest, options?: AionisRequestOptions): Promise<T>;
|
|
257
585
|
measure<T = unknown>(body: AionisJsonObject, options?: AionisRequestOptions): Promise<T>;
|
|
258
586
|
operatorSnapshot<T = unknown>(body: AionisJsonObject, options?: AionisRequestOptions): Promise<T>;
|
|
587
|
+
flightRecorder<T = AionisAgentFlightRecorderResponse>(body: AionisAgentFlightRecorderRequest, options?: AionisRequestOptions): Promise<T>;
|
|
259
588
|
snapshot<T = unknown>(body: AionisJsonObject, options?: AionisRequestOptions): Promise<T>;
|
|
260
589
|
health<T = unknown>(): Promise<T>;
|
|
261
590
|
private post;
|
|
@@ -265,6 +594,7 @@ export declare class AionisClient {
|
|
|
265
594
|
export declare class AionisExecutionClient {
|
|
266
595
|
private readonly client;
|
|
267
596
|
constructor(client: AionisClient);
|
|
597
|
+
compileAgentContext(input: AionisExecutionAgentContextCompileInput): AionisCompiledExecutionAgentContext;
|
|
268
598
|
observeStep<T = unknown>(input: AionisExecutionStepInput, options?: AionisRequestOptions): Promise<T>;
|
|
269
599
|
handoff<T = unknown>(input: AionisExecutionHandoffInput, options?: AionisRequestOptions): Promise<T>;
|
|
270
600
|
guideForRole<T = unknown>(input: AionisExecutionGuideForRoleInput, options?: AionisGuideRequestOptions): Promise<T>;
|
|
@@ -276,7 +606,33 @@ export declare class AionisExecutionClient {
|
|
|
276
606
|
export declare function createAionisClient(options: AionisClientOptions): AionisClient;
|
|
277
607
|
export declare function agentContextFromGuide<T = AionisJsonObject>(guide: unknown): T;
|
|
278
608
|
export declare function agentPromptFromGuide(guide: unknown): string;
|
|
609
|
+
export declare function rehydrateHintsFromGuide(guide: unknown): AionisRehydrateHint[];
|
|
610
|
+
export declare function memoryUseReceiptFromGuide(guide: unknown): AionisMemoryUseReceipt;
|
|
611
|
+
export declare function memoryAdmissionRecordFromGuide(guide: unknown): AionisMemoryAdmissionRecord;
|
|
612
|
+
export declare function memoryAdmissionDatasetRowsFromRecord(record: AionisMemoryAdmissionRecord, options?: AionisMemoryAdmissionDatasetExportOptions): AionisMemoryAdmissionDatasetRow[];
|
|
613
|
+
export declare function memoryAdmissionDatasetRowsFromRecords(records: AionisMemoryAdmissionRecord[], options?: AionisMemoryAdmissionDatasetExportOptions): AionisMemoryAdmissionDatasetRow[];
|
|
614
|
+
export declare function memoryAdmissionDatasetRowsFromGuide(guide: unknown, options?: AionisMemoryAdmissionDatasetExportOptions): AionisMemoryAdmissionDatasetRow[];
|
|
615
|
+
export declare function memoryAdmissionDatasetJsonlFromRows(rows: AionisMemoryAdmissionDatasetRow[]): string;
|
|
616
|
+
export declare function memoryAdmissionDatasetJsonlFromRecord(record: AionisMemoryAdmissionRecord, options?: AionisMemoryAdmissionDatasetExportOptions): string;
|
|
617
|
+
export declare function memoryAdmissionDatasetJsonlFromRecords(records: AionisMemoryAdmissionRecord[], options?: AionisMemoryAdmissionDatasetExportOptions): string;
|
|
618
|
+
export declare function memoryAdmissionDatasetJsonlFromGuide(guide: unknown, options?: AionisMemoryAdmissionDatasetExportOptions): string;
|
|
279
619
|
export declare function memoryIdsFromGuide(guide: unknown): string[];
|
|
620
|
+
export declare function routeContractFromGuide(guide: unknown): AionisRouteContract | null;
|
|
621
|
+
export declare function activeRouteTargetsFromGuide(guide: unknown): string[];
|
|
622
|
+
export declare function pendingArtifactTargetsFromGuide(guide: unknown): string[];
|
|
623
|
+
export declare function referenceOnlyRouteTargetsFromGuide(guide: unknown): string[];
|
|
624
|
+
export declare function blockedDirectionRouteTargetsFromGuide(guide: unknown): string[];
|
|
625
|
+
export declare function evidenceSourcesFromGuide(guide: unknown): AionisRouteContractEvidenceSource[];
|
|
626
|
+
export declare function blockedRoutesFromGuide(guide: unknown): AionisRouteContractBlockedRoute[];
|
|
627
|
+
export declare function compileExecutionAgentContext(input: AionisExecutionAgentContextCompileInput): AionisCompiledExecutionAgentContext;
|
|
628
|
+
export declare function compileCodingAgentContext(input: AionisExecutionAgentContextCompileInput): AionisCompiledExecutionAgentContext;
|
|
629
|
+
export declare function commandPostureFromGuide(guide: unknown, posture?: AionisCommandPostureKind): AionisCommandPosture[];
|
|
630
|
+
export declare function commandPostureMemoryIdsFromGuide(guide: unknown, posture?: AionisCommandPostureKind): string[];
|
|
631
|
+
export declare function mustNotMemoryIdsFromGuide(guide: unknown): string[];
|
|
632
|
+
export declare function shouldContinueMemoryIdsFromGuide(guide: unknown): string[];
|
|
633
|
+
export declare function inspectFirstMemoryIdsFromGuide(guide: unknown): string[];
|
|
634
|
+
export declare function rehydrateFirstMemoryIdsFromGuide(guide: unknown): string[];
|
|
635
|
+
export declare function optionalContextMemoryIdsFromGuide(guide: unknown): string[];
|
|
280
636
|
export declare function feedbackFromGuide(input: AionisFeedbackFromGuideInput): AionisFeedbackRequest;
|
|
281
637
|
export declare function measureInputFromGuideLoop(input: AionisMeasureFromGuideLoopInput): AionisJsonObject;
|
|
282
638
|
export declare function snapshotInputFromGuideLoop(input: AionisSnapshotFromGuideLoopInput): AionisJsonObject;
|