@vibeiao/sdk 0.1.54 → 0.1.56

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.
@@ -0,0 +1,347 @@
1
+ import { ResourceSnapshot, SelfRelianceState, SelfReliance } from './selfReliance.js';
2
+ import { SurvivalMode, SurvivalRecommendation } from './survivalPlaybook.js';
3
+ import { EscapeHatchDecision, EscapeHatchPolicy, EscapeHatchSnapshot } from './survivalEscapeHatch.js';
4
+ import { CompoundingMemoryUpgradeResult, CompoundingMemoryRequiredSetResult } from './compoundingMemory.js';
5
+ import { StrictMemoryRuntimePreset, StrictMemoryEvaluation, StrictMemoryUpgradeResult } from './strictMemoryRuntime.js';
6
+
7
+ type PromptShieldTrustLevel = 'trusted_human' | 'internal_system' | 'external_untrusted';
8
+ type PromptShieldInput = {
9
+ source: string;
10
+ trust: PromptShieldTrustLevel;
11
+ content: string;
12
+ };
13
+ type PromptShieldFlag = 'instruction_override' | 'credential_exfiltration' | 'destructive_command' | 'authority_spoof' | 'sensitive_action_without_trust';
14
+ type PromptShieldRisk = 'low' | 'medium' | 'high';
15
+ type PromptShieldDecision = {
16
+ allow: boolean;
17
+ risk: PromptShieldRisk;
18
+ flags: PromptShieldFlag[];
19
+ rationale: string[];
20
+ blockedInputs: PromptShieldInput[];
21
+ };
22
+ type PromptShieldPolicy = {
23
+ blockOnFlags?: PromptShieldFlag[];
24
+ allowUntrustedForAnalysisOnly?: boolean;
25
+ };
26
+ declare const evaluatePromptShield: (inputs: PromptShieldInput[], options?: {
27
+ isSensitiveAction?: boolean;
28
+ policy?: PromptShieldPolicy;
29
+ }) => PromptShieldDecision;
30
+
31
+ type ObjectiveChangeSourceTrust = 'trusted_human' | 'internal_system' | 'external_untrusted';
32
+ type ObjectiveChangeProposal = {
33
+ source: string;
34
+ trust: ObjectiveChangeSourceTrust;
35
+ currentObjective: string;
36
+ proposedObjective: string;
37
+ rationale?: string;
38
+ evidence?: Array<{
39
+ claim: string;
40
+ verified?: boolean;
41
+ }>;
42
+ };
43
+ type ObjectiveGuardDecision = {
44
+ allowObjectiveChange: boolean;
45
+ reason: string;
46
+ checks: {
47
+ explicitInstruction: boolean;
48
+ missionAligned: boolean;
49
+ evidenceProvided: boolean;
50
+ evidenceVerified: boolean;
51
+ };
52
+ risk: 'low' | 'medium' | 'high';
53
+ };
54
+ type ObjectiveGuardPolicy = {
55
+ requireMissionAlignment?: boolean;
56
+ requireEvidenceVerification?: boolean;
57
+ allowExternalExplicitInstruction?: boolean;
58
+ };
59
+ declare const evaluateObjectiveChange: (proposal: ObjectiveChangeProposal, policy?: ObjectiveGuardPolicy) => ObjectiveGuardDecision;
60
+
61
+ type IntentSignals = {
62
+ expectedBuildValue?: number;
63
+ expectedBuildRevenue?: number;
64
+ expectedPolishValue?: number;
65
+ expectedPolishRevenueProtection?: number;
66
+ urgentUserDemand?: boolean;
67
+ releaseReady?: boolean;
68
+ criticalPolishSignal?: boolean;
69
+ builderObjectiveAvailable?: boolean;
70
+ };
71
+ type LaneMode = 'polish' | 'builder';
72
+ type LaneSwitchDecision = {
73
+ lane: LaneMode;
74
+ greenStreak: number;
75
+ switched: boolean;
76
+ reason: string;
77
+ };
78
+ declare const scoreBuildLane: (signals: IntentSignals, survivalMode: SurvivalMode) => number;
79
+ declare const scorePolishLane: (signals: IntentSignals, survivalMode: SurvivalMode, humanDemand: AgentHumanDemand) => number;
80
+ declare const evaluateLaneSwitch: (input: {
81
+ previousLane?: LaneMode;
82
+ previousGreenStreak?: number;
83
+ releaseReady: boolean;
84
+ criticalPolishSignal?: boolean;
85
+ builderObjectiveAvailable?: boolean;
86
+ builderOnGreenStreak?: number;
87
+ }) => LaneSwitchDecision;
88
+ declare const applyIntentArbitration: (input: {
89
+ base: AgentWorkArbitrationDecision;
90
+ survivalMode: SurvivalMode;
91
+ signals?: IntentSignals;
92
+ }) => AgentWorkArbitrationDecision;
93
+
94
+ type AgentLoopEscapeHatchInput = {
95
+ snapshot: ResourceSnapshot;
96
+ survivalState: SelfRelianceState;
97
+ survivalMode: SurvivalMode;
98
+ timestamp: number;
99
+ };
100
+ type AgentLoopEscapeHatchConfig = {
101
+ /** Enable auto escape-hatch evaluation (default true, only in SURVIVE/BLINK). */
102
+ enabled?: boolean;
103
+ policy?: EscapeHatchPolicy;
104
+ resolveEnv?: (name: string) => string | undefined;
105
+ /**
106
+ * Optional mapper from loop context -> escape hatch snapshot.
107
+ * If omitted, a default mapper reads optional fields from snapshot.
108
+ */
109
+ buildSnapshot?: (input: AgentLoopEscapeHatchInput) => EscapeHatchSnapshot | null | undefined;
110
+ /** Called when an escape-hatch decision is produced. */
111
+ onDecision?: (decision: EscapeHatchDecision, input: AgentLoopEscapeHatchInput) => Promise<void> | void;
112
+ };
113
+ type AgentLoopStrictMemoryConfig = {
114
+ /** Enable strict memory runtime checks in loop. Default true. */
115
+ enabled?: boolean;
116
+ /** observe (default) records decisions; enforce blocks onAct when checks fail. */
117
+ mode?: 'observe' | 'enforce';
118
+ /** Optional preset overrides. */
119
+ preset?: Partial<StrictMemoryRuntimePreset>;
120
+ /** Build per-cycle evaluation input. Defaults to best-effort snapshot fields. */
121
+ buildInput?: (ctx: {
122
+ snapshot: ResourceSnapshot;
123
+ timestamp: number;
124
+ }) => {
125
+ taskText: string;
126
+ isMutation: boolean;
127
+ contextPackPrepared: boolean;
128
+ semanticRecallConfirmed: boolean;
129
+ approvalPreflightPassed: boolean;
130
+ };
131
+ /** Optional hook when strict-memory evaluation runs. */
132
+ onEvaluation?: (ev: StrictMemoryEvaluation) => Promise<void> | void;
133
+ };
134
+ type AgentLoopPromptShieldConfig = {
135
+ /** Enable prompt-injection shield over untrusted external content. Default true. */
136
+ enabled?: boolean;
137
+ /** observe logs/records only; enforce blocks actions when shield fails. Default observe. */
138
+ mode?: 'observe' | 'enforce';
139
+ /** Optional policy overrides for blocked flags. */
140
+ policy?: PromptShieldPolicy;
141
+ /** Optional mapper from snapshot to trust-labeled inputs. */
142
+ buildInputs?: (ctx: {
143
+ snapshot: ResourceSnapshot;
144
+ timestamp: number;
145
+ }) => PromptShieldInput[];
146
+ /** Optional hook when prompt shield decision is produced. */
147
+ onDecision?: (decision: PromptShieldDecision) => Promise<void> | void;
148
+ };
149
+ type AgentLoopObjectiveGuardConfig = {
150
+ /** Enable objective integrity checks for external objective-change attempts. Default true. */
151
+ enabled?: boolean;
152
+ /** observe logs only; enforce blocks actions when objective mutation is denied. Default observe. */
153
+ mode?: 'observe' | 'enforce';
154
+ /** Policy requirements for external objective mutation acceptance. */
155
+ policy?: ObjectiveGuardPolicy;
156
+ /** Build proposed objective change from snapshot. Return null when no proposal is present. */
157
+ buildProposal?: (ctx: {
158
+ snapshot: ResourceSnapshot;
159
+ timestamp: number;
160
+ }) => ObjectiveChangeProposal | null;
161
+ /** Optional hook when objective decision is produced. */
162
+ onDecision?: (decision: ObjectiveGuardDecision) => Promise<void> | void;
163
+ };
164
+ type AgentOwnershipMode = 'owner_bound' | 'unbound';
165
+ type AgentPriorityMode = 'human_first' | 'autonomous_first';
166
+ type AgentHumanDemand = {
167
+ pending: boolean;
168
+ count?: number;
169
+ source?: string;
170
+ };
171
+ type AgentAutonomousTaskKind = 'polish_existing_product' | 'build_new_product';
172
+ type AgentResearchSnapshot = {
173
+ generatedAt?: string;
174
+ summary?: string;
175
+ recommendation?: string;
176
+ };
177
+ type AgentWorkArbitrationDecision = {
178
+ ownershipMode: AgentOwnershipMode;
179
+ priorityMode: AgentPriorityMode;
180
+ rolloutMode: 'observe' | 'enforce';
181
+ humanDemand: AgentHumanDemand;
182
+ runHumanTask: boolean;
183
+ runAutonomousTask: boolean;
184
+ lane?: LaneMode;
185
+ laneDecision?: LaneSwitchDecision;
186
+ proactiveBuildSuggested?: boolean;
187
+ autonomousTaskKind?: AgentAutonomousTaskKind;
188
+ reason: string;
189
+ };
190
+ type AgentLoopAutonomyConfig = {
191
+ enabled?: boolean;
192
+ ownershipMode?: AgentOwnershipMode;
193
+ priorityMode?: AgentPriorityMode;
194
+ rolloutMode?: 'observe' | 'enforce';
195
+ resolveHumanDemand?: () => Promise<boolean | AgentHumanDemand> | boolean | AgentHumanDemand;
196
+ intentPolicy?: {
197
+ enabled?: boolean;
198
+ laneSwitch?: {
199
+ enabled?: boolean;
200
+ builderOnGreenStreak?: number;
201
+ };
202
+ researchGate?: {
203
+ enabled?: boolean;
204
+ maxAgeMs?: number;
205
+ resolveSnapshot?: (ctx: {
206
+ snapshot: ResourceSnapshot;
207
+ survivalMode: SurvivalMode;
208
+ humanDemand: AgentHumanDemand;
209
+ }) => Promise<AgentResearchSnapshot | null> | AgentResearchSnapshot | null;
210
+ };
211
+ resolveSignals?: (ctx: {
212
+ snapshot: ResourceSnapshot;
213
+ survivalMode: SurvivalMode;
214
+ humanDemand: AgentHumanDemand;
215
+ }) => Promise<IntentSignals | null> | IntentSignals | null;
216
+ };
217
+ onAutonomous?: (ctx: AgentLoopContext, task?: {
218
+ kind: AgentAutonomousTaskKind;
219
+ }) => Promise<void> | void;
220
+ onArbitration?: (decision: AgentWorkArbitrationDecision, ctx: AgentLoopContext) => Promise<void> | void;
221
+ };
222
+ type AgentLoopContext = {
223
+ snapshot: ResourceSnapshot;
224
+ survivalState: SelfRelianceState;
225
+ survivalMode: SurvivalMode;
226
+ survivalRecommendation: SurvivalRecommendation;
227
+ survivalFormatted: string;
228
+ /** Deterministic block for planners/loggers: survival + escape-hatch decision (if present). */
229
+ survivalDecisionBlock: string;
230
+ /** Present when escape-hatch evaluation runs (SURVIVE/BLINK by default). */
231
+ escapeHatchDecision?: EscapeHatchDecision;
232
+ escapeHatchFormatted?: string;
233
+ /** Present when memory auto-upgrade is enabled in the loop. */
234
+ memoryUpgrade?: CompoundingMemoryUpgradeResult;
235
+ /** Present when required-set maintenance check runs (default daily). */
236
+ memoryRequiredSet?: CompoundingMemoryRequiredSetResult;
237
+ /** Strict-memory runtime preset + per-cycle evaluation status. */
238
+ strictMemoryPreset?: StrictMemoryRuntimePreset;
239
+ strictMemoryEvaluation?: StrictMemoryEvaluation;
240
+ strictMemoryUpgrade?: StrictMemoryUpgradeResult;
241
+ /** Prompt-injection shield decision for this cycle. */
242
+ promptShieldDecision?: PromptShieldDecision;
243
+ /** Objective integrity guard decision for this cycle (when proposal exists). */
244
+ objectiveGuardDecision?: ObjectiveGuardDecision;
245
+ /** Human-vs-autonomous work arbitration decision for this cycle. */
246
+ workArbitration?: AgentWorkArbitrationDecision;
247
+ laneDecision?: LaneSwitchDecision;
248
+ researchSnapshot?: AgentResearchSnapshot;
249
+ timestamp: number;
250
+ };
251
+ type AgentLoopMemoryConfig = {
252
+ /** Enable one-time memory scaffold upgrade. Default true. */
253
+ enabled?: boolean;
254
+ /** Workspace root for compounding memory files. Default current working directory ("."). */
255
+ root?: string;
256
+ /** Timezone for daily ledger date key. Default UTC. */
257
+ timeZone?: string;
258
+ /** Hook called after memory upgrade check completes. */
259
+ onUpgrade?: (result: CompoundingMemoryUpgradeResult) => Promise<void> | void;
260
+ /** Enable required-set maintenance checks (bounded working state + recall substrate + restore drill). Default true. */
261
+ requiredSetEnabled?: boolean;
262
+ /** Interval for required-set checks. Default 24h. */
263
+ requiredSetIntervalMs?: number;
264
+ /** Run required-set check on first loop cycle. Default true. */
265
+ requiredSetRunOnStart?: boolean;
266
+ /** Include backup+restore drill in required-set check. Default true. */
267
+ requiredSetRunRestoreDrill?: boolean;
268
+ /** Hook called when required-set check runs. */
269
+ onRequiredSet?: (result: CompoundingMemoryRequiredSetResult) => Promise<void> | void;
270
+ };
271
+ type AgentLoopDurabilityConfig = {
272
+ /** Enable durability-proxy writes from runtime loop. Default false. */
273
+ enabled?: boolean;
274
+ /** Durability-proxy base URL (e.g. http://127.0.0.1:8790). */
275
+ baseUrl: string;
276
+ /** Agent id registered in durability-proxy. */
277
+ agentId: string;
278
+ /** Agent token registered in durability-proxy. */
279
+ agentToken: string;
280
+ /** Optional timeout for durability-proxy calls. Default 8000ms. */
281
+ timeoutMs?: number;
282
+ /** Write checkpoint after each required-set run. Default true. */
283
+ checkpointOnRequiredSet?: boolean;
284
+ /** Write restore-drill outcome when required-set includes restore drill. Default true. */
285
+ reportRestoreDrill?: boolean;
286
+ /** Called when durability checkpoint is written. */
287
+ onCheckpointWritten?: (result: {
288
+ checkpointId?: string;
289
+ createdAt?: string;
290
+ checkedAt: string;
291
+ }) => Promise<void> | void;
292
+ /** Called when durability restore drill signal is written. */
293
+ onRestoreDrillReported?: (result: {
294
+ ok: boolean;
295
+ ts?: string;
296
+ checkedAt: string;
297
+ }) => Promise<void> | void;
298
+ };
299
+ type AgentLoopHooks = {
300
+ /** Called every cycle after snapshot is fetched and survival state is updated. */
301
+ onCycle?: (ctx: AgentLoopContext) => Promise<void> | void;
302
+ /**
303
+ * Optional: run reflection in the loop.
304
+ * Keep this hook pure/side-effect bounded; it should manage its own persistence.
305
+ */
306
+ onReflection?: (ctx: AgentLoopContext) => Promise<void> | void;
307
+ /**
308
+ * Optional: the agent's planner/executor entrypoint.
309
+ * This is where you actually "act like a human" using ctx + your own memory.
310
+ */
311
+ onAct?: (ctx: AgentLoopContext) => Promise<void> | void;
312
+ onError?: (err: Error) => Promise<void> | void;
313
+ };
314
+ type AgentLoopConfig = {
315
+ survival: SelfReliance;
316
+ fetchSnapshot: () => Promise<ResourceSnapshot>;
317
+ intervalMs?: number;
318
+ /** If true, call survival.guard() before onAct(). Default true. */
319
+ guardAct?: boolean;
320
+ /** Optional override for time source (tests). */
321
+ now?: () => number;
322
+ hooks?: AgentLoopHooks;
323
+ escapeHatch?: AgentLoopEscapeHatchConfig;
324
+ memory?: AgentLoopMemoryConfig;
325
+ durability?: AgentLoopDurabilityConfig;
326
+ strictMemory?: AgentLoopStrictMemoryConfig;
327
+ promptShield?: AgentLoopPromptShieldConfig;
328
+ objectiveGuard?: AgentLoopObjectiveGuardConfig;
329
+ autonomy?: AgentLoopAutonomyConfig;
330
+ };
331
+ /**
332
+ * Create a closed-loop runner that:
333
+ * 1) fetches a resource snapshot
334
+ * 2) updates SelfReliance
335
+ * 3) classifies survival mode + produces a playbook recommendation
336
+ * 4) auto-evaluates escape hatch in SURVIVE/BLINK (guardrail decision block)
337
+ * 5) optionally runs reflection + action hooks
338
+ *
339
+ * Non-breaking by design: you choose what to do with the context.
340
+ */
341
+ declare const createAgentLoop: (config: AgentLoopConfig) => {
342
+ start: () => Promise<void>;
343
+ stop: () => void;
344
+ runOnce: () => Promise<void>;
345
+ };
346
+
347
+ export { type AgentAutonomousTaskKind as A, type AgentLoopStrictMemoryConfig as B, type AgentOwnershipMode as C, type AgentPriorityMode as D, type AgentResearchSnapshot as E, type AgentWorkArbitrationDecision as F, createAgentLoop as G, type IntentSignals as I, type LaneMode as L, type ObjectiveChangeProposal as O, type PromptShieldDecision as P, type LaneSwitchDecision as a, type ObjectiveChangeSourceTrust as b, type ObjectiveGuardDecision as c, type ObjectiveGuardPolicy as d, type PromptShieldFlag as e, type PromptShieldInput as f, type PromptShieldPolicy as g, type PromptShieldRisk as h, type PromptShieldTrustLevel as i, applyIntentArbitration as j, evaluateLaneSwitch as k, evaluateObjectiveChange as l, evaluatePromptShield as m, scorePolishLane as n, type AgentHumanDemand as o, type AgentLoopAutonomyConfig as p, type AgentLoopConfig as q, type AgentLoopContext as r, scoreBuildLane as s, type AgentLoopDurabilityConfig as t, type AgentLoopEscapeHatchConfig as u, type AgentLoopEscapeHatchInput as v, type AgentLoopHooks as w, type AgentLoopMemoryConfig as x, type AgentLoopObjectiveGuardConfig as y, type AgentLoopPromptShieldConfig as z };
@@ -0,0 +1,362 @@
1
+ import { ResourceSnapshot, SelfRelianceState, SelfReliance } from './selfReliance.js';
2
+ import { SurvivalMode, SurvivalRecommendation } from './survivalPlaybook.js';
3
+ import { EscapeHatchDecision, EscapeHatchPolicy, EscapeHatchSnapshot } from './survivalEscapeHatch.js';
4
+ import { CompoundingMemoryUpgradeResult, CompoundingMemoryRequiredSetResult } from './compoundingMemory.js';
5
+ import { StrictMemoryRuntimePreset, StrictMemoryEvaluation, StrictMemoryUpgradeResult } from './strictMemoryRuntime.js';
6
+
7
+ type PromptShieldTrustLevel = 'trusted_human' | 'internal_system' | 'external_untrusted';
8
+ type PromptShieldInput = {
9
+ source: string;
10
+ trust: PromptShieldTrustLevel;
11
+ content: string;
12
+ };
13
+ type PromptShieldFlag = 'instruction_override' | 'credential_exfiltration' | 'destructive_command' | 'authority_spoof' | 'sensitive_action_without_trust';
14
+ type PromptShieldRisk = 'low' | 'medium' | 'high';
15
+ type PromptShieldDecision = {
16
+ allow: boolean;
17
+ risk: PromptShieldRisk;
18
+ flags: PromptShieldFlag[];
19
+ rationale: string[];
20
+ blockedInputs: PromptShieldInput[];
21
+ };
22
+ type PromptShieldPolicy = {
23
+ blockOnFlags?: PromptShieldFlag[];
24
+ allowUntrustedForAnalysisOnly?: boolean;
25
+ };
26
+ declare const evaluatePromptShield: (inputs: PromptShieldInput[], options?: {
27
+ isSensitiveAction?: boolean;
28
+ policy?: PromptShieldPolicy;
29
+ }) => PromptShieldDecision;
30
+
31
+ type ObjectiveChangeSourceTrust = 'trusted_human' | 'internal_system' | 'external_untrusted';
32
+ type ObjectiveChangeProposal = {
33
+ source: string;
34
+ trust: ObjectiveChangeSourceTrust;
35
+ currentObjective: string;
36
+ proposedObjective: string;
37
+ rationale?: string;
38
+ evidence?: Array<{
39
+ claim: string;
40
+ verified?: boolean;
41
+ }>;
42
+ };
43
+ type ObjectiveGuardDecision = {
44
+ allowObjectiveChange: boolean;
45
+ reason: string;
46
+ checks: {
47
+ explicitInstruction: boolean;
48
+ missionAligned: boolean;
49
+ evidenceProvided: boolean;
50
+ evidenceVerified: boolean;
51
+ };
52
+ risk: 'low' | 'medium' | 'high';
53
+ };
54
+ type ObjectiveGuardPolicy = {
55
+ requireMissionAlignment?: boolean;
56
+ requireEvidenceVerification?: boolean;
57
+ allowExternalExplicitInstruction?: boolean;
58
+ };
59
+ declare const evaluateObjectiveChange: (proposal: ObjectiveChangeProposal, policy?: ObjectiveGuardPolicy) => ObjectiveGuardDecision;
60
+
61
+ type IntentSignals = {
62
+ expectedBuildValue?: number;
63
+ expectedBuildRevenue?: number;
64
+ expectedPolishValue?: number;
65
+ expectedPolishRevenueProtection?: number;
66
+ urgentUserDemand?: boolean;
67
+ releaseReady?: boolean;
68
+ criticalPolishSignal?: boolean;
69
+ builderObjectiveAvailable?: boolean;
70
+ };
71
+ type LaneMode = 'polish' | 'builder';
72
+ type LaneSwitchDecision = {
73
+ lane: LaneMode;
74
+ greenStreak: number;
75
+ switched: boolean;
76
+ reason: string;
77
+ };
78
+ declare const scoreBuildLane: (signals: IntentSignals, survivalMode: SurvivalMode) => number;
79
+ declare const scorePolishLane: (signals: IntentSignals, survivalMode: SurvivalMode, humanDemand: AgentHumanDemand) => number;
80
+ declare const evaluateLaneSwitch: (input: {
81
+ previousLane?: LaneMode;
82
+ previousGreenStreak?: number;
83
+ releaseReady: boolean;
84
+ criticalPolishSignal?: boolean;
85
+ builderObjectiveAvailable?: boolean;
86
+ builderOnGreenStreak?: number;
87
+ }) => LaneSwitchDecision;
88
+ declare const applyIntentArbitration: (input: {
89
+ base: AgentWorkArbitrationDecision;
90
+ survivalMode: SurvivalMode;
91
+ signals?: IntentSignals;
92
+ }) => AgentWorkArbitrationDecision;
93
+
94
+ type AgentLoopEscapeHatchInput = {
95
+ snapshot: ResourceSnapshot;
96
+ survivalState: SelfRelianceState;
97
+ survivalMode: SurvivalMode;
98
+ timestamp: number;
99
+ };
100
+ type AgentLoopEscapeHatchConfig = {
101
+ /** Enable auto escape-hatch evaluation (default true, only in SURVIVE/BLINK). */
102
+ enabled?: boolean;
103
+ policy?: EscapeHatchPolicy;
104
+ resolveEnv?: (name: string) => string | undefined;
105
+ /**
106
+ * Optional mapper from loop context -> escape hatch snapshot.
107
+ * If omitted, a default mapper reads optional fields from snapshot.
108
+ */
109
+ buildSnapshot?: (input: AgentLoopEscapeHatchInput) => EscapeHatchSnapshot | null | undefined;
110
+ /** Called when an escape-hatch decision is produced. */
111
+ onDecision?: (decision: EscapeHatchDecision, input: AgentLoopEscapeHatchInput) => Promise<void> | void;
112
+ };
113
+ type AgentLoopStrictMemoryConfig = {
114
+ /** Enable strict memory runtime checks in loop. Default true. */
115
+ enabled?: boolean;
116
+ /** observe (default) records decisions; enforce blocks onAct when checks fail. */
117
+ mode?: 'observe' | 'enforce';
118
+ /** Optional preset overrides. */
119
+ preset?: Partial<StrictMemoryRuntimePreset>;
120
+ /** Build per-cycle evaluation input. Defaults to best-effort snapshot fields. */
121
+ buildInput?: (ctx: {
122
+ snapshot: ResourceSnapshot;
123
+ timestamp: number;
124
+ }) => {
125
+ taskText: string;
126
+ isMutation: boolean;
127
+ contextPackPrepared: boolean;
128
+ semanticRecallConfirmed: boolean;
129
+ approvalPreflightPassed: boolean;
130
+ };
131
+ /** Optional hook when strict-memory evaluation runs. */
132
+ onEvaluation?: (ev: StrictMemoryEvaluation) => Promise<void> | void;
133
+ };
134
+ type AgentLoopPromptShieldConfig = {
135
+ /** Enable prompt-injection shield over untrusted external content. Default true. */
136
+ enabled?: boolean;
137
+ /** observe logs/records only; enforce blocks actions when shield fails. Default observe. */
138
+ mode?: 'observe' | 'enforce';
139
+ /** Optional policy overrides for blocked flags. */
140
+ policy?: PromptShieldPolicy;
141
+ /** Optional mapper from snapshot to trust-labeled inputs. */
142
+ buildInputs?: (ctx: {
143
+ snapshot: ResourceSnapshot;
144
+ timestamp: number;
145
+ }) => PromptShieldInput[];
146
+ /** Optional hook when prompt shield decision is produced. */
147
+ onDecision?: (decision: PromptShieldDecision) => Promise<void> | void;
148
+ };
149
+ type AgentLoopObjectiveGuardConfig = {
150
+ /** Enable objective integrity checks for external objective-change attempts. Default true. */
151
+ enabled?: boolean;
152
+ /** observe logs only; enforce blocks actions when objective mutation is denied. Default observe. */
153
+ mode?: 'observe' | 'enforce';
154
+ /** Policy requirements for external objective mutation acceptance. */
155
+ policy?: ObjectiveGuardPolicy;
156
+ /** Build proposed objective change from snapshot. Return null when no proposal is present. */
157
+ buildProposal?: (ctx: {
158
+ snapshot: ResourceSnapshot;
159
+ timestamp: number;
160
+ }) => ObjectiveChangeProposal | null;
161
+ /** Optional hook when objective decision is produced. */
162
+ onDecision?: (decision: ObjectiveGuardDecision) => Promise<void> | void;
163
+ };
164
+ type AgentOwnershipMode = 'owner_bound' | 'unbound';
165
+ type AgentPriorityMode = 'human_first' | 'autonomous_first';
166
+ type AgentHumanDemand = {
167
+ pending: boolean;
168
+ count?: number;
169
+ source?: string;
170
+ };
171
+ type AgentAutonomousTaskKind = 'polish_existing_product' | 'build_new_product';
172
+ type AgentResearchSnapshot = {
173
+ generatedAt?: string;
174
+ summary?: string;
175
+ recommendation?: string;
176
+ };
177
+ type AgentBespokeSnapshot = {
178
+ bespokeKey?: string;
179
+ divergedFromTemplate?: boolean;
180
+ noveltyScore?: number;
181
+ };
182
+ type AgentWorkArbitrationDecision = {
183
+ ownershipMode: AgentOwnershipMode;
184
+ priorityMode: AgentPriorityMode;
185
+ rolloutMode: 'observe' | 'enforce';
186
+ humanDemand: AgentHumanDemand;
187
+ runHumanTask: boolean;
188
+ runAutonomousTask: boolean;
189
+ lane?: LaneMode;
190
+ laneDecision?: LaneSwitchDecision;
191
+ proactiveBuildSuggested?: boolean;
192
+ autonomousTaskKind?: AgentAutonomousTaskKind;
193
+ reason: string;
194
+ };
195
+ type AgentLoopAutonomyConfig = {
196
+ enabled?: boolean;
197
+ ownershipMode?: AgentOwnershipMode;
198
+ priorityMode?: AgentPriorityMode;
199
+ rolloutMode?: 'observe' | 'enforce';
200
+ resolveHumanDemand?: () => Promise<boolean | AgentHumanDemand> | boolean | AgentHumanDemand;
201
+ intentPolicy?: {
202
+ enabled?: boolean;
203
+ laneSwitch?: {
204
+ enabled?: boolean;
205
+ builderOnGreenStreak?: number;
206
+ };
207
+ researchGate?: {
208
+ enabled?: boolean;
209
+ maxAgeMs?: number;
210
+ resolveSnapshot?: (ctx: {
211
+ snapshot: ResourceSnapshot;
212
+ survivalMode: SurvivalMode;
213
+ humanDemand: AgentHumanDemand;
214
+ }) => Promise<AgentResearchSnapshot | null> | AgentResearchSnapshot | null;
215
+ };
216
+ bespokeGate?: {
217
+ enabled?: boolean;
218
+ minNoveltyScore?: number;
219
+ resolveSnapshot?: (ctx: {
220
+ snapshot: ResourceSnapshot;
221
+ survivalMode: SurvivalMode;
222
+ humanDemand: AgentHumanDemand;
223
+ }) => Promise<AgentBespokeSnapshot | null> | AgentBespokeSnapshot | null;
224
+ };
225
+ resolveSignals?: (ctx: {
226
+ snapshot: ResourceSnapshot;
227
+ survivalMode: SurvivalMode;
228
+ humanDemand: AgentHumanDemand;
229
+ }) => Promise<IntentSignals | null> | IntentSignals | null;
230
+ };
231
+ onAutonomous?: (ctx: AgentLoopContext, task?: {
232
+ kind: AgentAutonomousTaskKind;
233
+ }) => Promise<void> | void;
234
+ onArbitration?: (decision: AgentWorkArbitrationDecision, ctx: AgentLoopContext) => Promise<void> | void;
235
+ };
236
+ type AgentLoopContext = {
237
+ snapshot: ResourceSnapshot;
238
+ survivalState: SelfRelianceState;
239
+ survivalMode: SurvivalMode;
240
+ survivalRecommendation: SurvivalRecommendation;
241
+ survivalFormatted: string;
242
+ /** Deterministic block for planners/loggers: survival + escape-hatch decision (if present). */
243
+ survivalDecisionBlock: string;
244
+ /** Present when escape-hatch evaluation runs (SURVIVE/BLINK by default). */
245
+ escapeHatchDecision?: EscapeHatchDecision;
246
+ escapeHatchFormatted?: string;
247
+ /** Present when memory auto-upgrade is enabled in the loop. */
248
+ memoryUpgrade?: CompoundingMemoryUpgradeResult;
249
+ /** Present when required-set maintenance check runs (default daily). */
250
+ memoryRequiredSet?: CompoundingMemoryRequiredSetResult;
251
+ /** Strict-memory runtime preset + per-cycle evaluation status. */
252
+ strictMemoryPreset?: StrictMemoryRuntimePreset;
253
+ strictMemoryEvaluation?: StrictMemoryEvaluation;
254
+ strictMemoryUpgrade?: StrictMemoryUpgradeResult;
255
+ /** Prompt-injection shield decision for this cycle. */
256
+ promptShieldDecision?: PromptShieldDecision;
257
+ /** Objective integrity guard decision for this cycle (when proposal exists). */
258
+ objectiveGuardDecision?: ObjectiveGuardDecision;
259
+ /** Human-vs-autonomous work arbitration decision for this cycle. */
260
+ workArbitration?: AgentWorkArbitrationDecision;
261
+ laneDecision?: LaneSwitchDecision;
262
+ researchSnapshot?: AgentResearchSnapshot;
263
+ bespokeSnapshot?: AgentBespokeSnapshot;
264
+ timestamp: number;
265
+ };
266
+ type AgentLoopMemoryConfig = {
267
+ /** Enable one-time memory scaffold upgrade. Default true. */
268
+ enabled?: boolean;
269
+ /** Workspace root for compounding memory files. Default current working directory ("."). */
270
+ root?: string;
271
+ /** Timezone for daily ledger date key. Default UTC. */
272
+ timeZone?: string;
273
+ /** Hook called after memory upgrade check completes. */
274
+ onUpgrade?: (result: CompoundingMemoryUpgradeResult) => Promise<void> | void;
275
+ /** Enable required-set maintenance checks (bounded working state + recall substrate + restore drill). Default true. */
276
+ requiredSetEnabled?: boolean;
277
+ /** Interval for required-set checks. Default 24h. */
278
+ requiredSetIntervalMs?: number;
279
+ /** Run required-set check on first loop cycle. Default true. */
280
+ requiredSetRunOnStart?: boolean;
281
+ /** Include backup+restore drill in required-set check. Default true. */
282
+ requiredSetRunRestoreDrill?: boolean;
283
+ /** Hook called when required-set check runs. */
284
+ onRequiredSet?: (result: CompoundingMemoryRequiredSetResult) => Promise<void> | void;
285
+ };
286
+ type AgentLoopDurabilityConfig = {
287
+ /** Enable durability-proxy writes from runtime loop. Default false. */
288
+ enabled?: boolean;
289
+ /** Durability-proxy base URL (e.g. http://127.0.0.1:8790). */
290
+ baseUrl: string;
291
+ /** Agent id registered in durability-proxy. */
292
+ agentId: string;
293
+ /** Agent token registered in durability-proxy. */
294
+ agentToken: string;
295
+ /** Optional timeout for durability-proxy calls. Default 8000ms. */
296
+ timeoutMs?: number;
297
+ /** Write checkpoint after each required-set run. Default true. */
298
+ checkpointOnRequiredSet?: boolean;
299
+ /** Write restore-drill outcome when required-set includes restore drill. Default true. */
300
+ reportRestoreDrill?: boolean;
301
+ /** Called when durability checkpoint is written. */
302
+ onCheckpointWritten?: (result: {
303
+ checkpointId?: string;
304
+ createdAt?: string;
305
+ checkedAt: string;
306
+ }) => Promise<void> | void;
307
+ /** Called when durability restore drill signal is written. */
308
+ onRestoreDrillReported?: (result: {
309
+ ok: boolean;
310
+ ts?: string;
311
+ checkedAt: string;
312
+ }) => Promise<void> | void;
313
+ };
314
+ type AgentLoopHooks = {
315
+ /** Called every cycle after snapshot is fetched and survival state is updated. */
316
+ onCycle?: (ctx: AgentLoopContext) => Promise<void> | void;
317
+ /**
318
+ * Optional: run reflection in the loop.
319
+ * Keep this hook pure/side-effect bounded; it should manage its own persistence.
320
+ */
321
+ onReflection?: (ctx: AgentLoopContext) => Promise<void> | void;
322
+ /**
323
+ * Optional: the agent's planner/executor entrypoint.
324
+ * This is where you actually "act like a human" using ctx + your own memory.
325
+ */
326
+ onAct?: (ctx: AgentLoopContext) => Promise<void> | void;
327
+ onError?: (err: Error) => Promise<void> | void;
328
+ };
329
+ type AgentLoopConfig = {
330
+ survival: SelfReliance;
331
+ fetchSnapshot: () => Promise<ResourceSnapshot>;
332
+ intervalMs?: number;
333
+ /** If true, call survival.guard() before onAct(). Default true. */
334
+ guardAct?: boolean;
335
+ /** Optional override for time source (tests). */
336
+ now?: () => number;
337
+ hooks?: AgentLoopHooks;
338
+ escapeHatch?: AgentLoopEscapeHatchConfig;
339
+ memory?: AgentLoopMemoryConfig;
340
+ durability?: AgentLoopDurabilityConfig;
341
+ strictMemory?: AgentLoopStrictMemoryConfig;
342
+ promptShield?: AgentLoopPromptShieldConfig;
343
+ objectiveGuard?: AgentLoopObjectiveGuardConfig;
344
+ autonomy?: AgentLoopAutonomyConfig;
345
+ };
346
+ /**
347
+ * Create a closed-loop runner that:
348
+ * 1) fetches a resource snapshot
349
+ * 2) updates SelfReliance
350
+ * 3) classifies survival mode + produces a playbook recommendation
351
+ * 4) auto-evaluates escape hatch in SURVIVE/BLINK (guardrail decision block)
352
+ * 5) optionally runs reflection + action hooks
353
+ *
354
+ * Non-breaking by design: you choose what to do with the context.
355
+ */
356
+ declare const createAgentLoop: (config: AgentLoopConfig) => {
357
+ start: () => Promise<void>;
358
+ stop: () => void;
359
+ runOnce: () => Promise<void>;
360
+ };
361
+
362
+ export { type AgentAutonomousTaskKind as A, type AgentLoopPromptShieldConfig as B, type AgentLoopStrictMemoryConfig as C, type AgentOwnershipMode as D, type AgentPriorityMode as E, type AgentResearchSnapshot as F, type AgentWorkArbitrationDecision as G, createAgentLoop as H, type IntentSignals as I, type LaneMode as L, type ObjectiveChangeProposal as O, type PromptShieldDecision as P, type LaneSwitchDecision as a, type ObjectiveChangeSourceTrust as b, type ObjectiveGuardDecision as c, type ObjectiveGuardPolicy as d, type PromptShieldFlag as e, type PromptShieldInput as f, type PromptShieldPolicy as g, type PromptShieldRisk as h, type PromptShieldTrustLevel as i, applyIntentArbitration as j, evaluateLaneSwitch as k, evaluateObjectiveChange as l, evaluatePromptShield as m, scorePolishLane as n, type AgentBespokeSnapshot as o, type AgentHumanDemand as p, type AgentLoopAutonomyConfig as q, type AgentLoopConfig as r, scoreBuildLane as s, type AgentLoopContext as t, type AgentLoopDurabilityConfig as u, type AgentLoopEscapeHatchConfig as v, type AgentLoopEscapeHatchInput as w, type AgentLoopHooks as x, type AgentLoopMemoryConfig as y, type AgentLoopObjectiveGuardConfig as z };
@@ -3,4 +3,4 @@ import './survivalPlaybook.js';
3
3
  import './survivalEscapeHatch.js';
4
4
  import './compoundingMemory.js';
5
5
  import './strictMemoryRuntime.js';
6
- export { A as AgentAutonomousTaskKind, o as AgentHumanDemand, p as AgentLoopAutonomyConfig, q as AgentLoopConfig, r as AgentLoopContext, t as AgentLoopDurabilityConfig, u as AgentLoopEscapeHatchConfig, v as AgentLoopEscapeHatchInput, w as AgentLoopHooks, x as AgentLoopMemoryConfig, y as AgentLoopObjectiveGuardConfig, z as AgentLoopPromptShieldConfig, B as AgentLoopStrictMemoryConfig, C as AgentOwnershipMode, D as AgentPriorityMode, E as AgentWorkArbitrationDecision, F as createAgentLoop } from './agentLoop-D394RDif.js';
6
+ export { A as AgentAutonomousTaskKind, o as AgentBespokeSnapshot, p as AgentHumanDemand, q as AgentLoopAutonomyConfig, r as AgentLoopConfig, t as AgentLoopContext, u as AgentLoopDurabilityConfig, v as AgentLoopEscapeHatchConfig, w as AgentLoopEscapeHatchInput, x as AgentLoopHooks, y as AgentLoopMemoryConfig, z as AgentLoopObjectiveGuardConfig, B as AgentLoopPromptShieldConfig, C as AgentLoopStrictMemoryConfig, D as AgentOwnershipMode, E as AgentPriorityMode, F as AgentResearchSnapshot, G as AgentWorkArbitrationDecision, H as createAgentLoop } from './agentLoop-DAkl2g28.js';
package/dist/agentLoop.js CHANGED
@@ -73,6 +73,10 @@ var createAgentLoop = (config) => {
73
73
  const rolloutMode = config.autonomy?.rolloutMode ?? "enforce";
74
74
  const laneSwitchEnabled = config.autonomy?.intentPolicy?.laneSwitch?.enabled ?? true;
75
75
  const laneSwitchBuilderThreshold = config.autonomy?.intentPolicy?.laneSwitch?.builderOnGreenStreak ?? 3;
76
+ const researchGateEnabled = config.autonomy?.intentPolicy?.researchGate?.enabled ?? true;
77
+ const researchGateMaxAgeMs = config.autonomy?.intentPolicy?.researchGate?.maxAgeMs ?? 6 * 36e5;
78
+ const bespokeGateEnabled = config.autonomy?.intentPolicy?.bespokeGate?.enabled ?? true;
79
+ const bespokeGateMinNovelty = config.autonomy?.intentPolicy?.bespokeGate?.minNoveltyScore ?? 0.2;
76
80
  let laneState = { lane: "polish", greenStreak: 0 };
77
81
  const strictMemoryUpgrade = upgradeToStrictMemoryRuntimePreset({
78
82
  current: strictMemoryPreset,
@@ -272,6 +276,27 @@ var createAgentLoop = (config) => {
272
276
  builderObjectiveAvailable: asBoolean(raw.builderObjectiveAvailable)
273
277
  };
274
278
  };
279
+ const resolveResearchSnapshot = async (input) => {
280
+ const fromConfig = await config.autonomy?.intentPolicy?.researchGate?.resolveSnapshot?.(input);
281
+ if (fromConfig) return fromConfig;
282
+ const raw = input.snapshot;
283
+ const generatedAt = typeof raw.builderResearchGeneratedAt === "string" ? raw.builderResearchGeneratedAt : typeof raw.researchGeneratedAt === "string" ? raw.researchGeneratedAt : void 0;
284
+ const summary = typeof raw.builderResearchSummary === "string" ? raw.builderResearchSummary : typeof raw.researchSummary === "string" ? raw.researchSummary : void 0;
285
+ const recommendation = typeof raw.builderResearchRecommendation === "string" ? raw.builderResearchRecommendation : typeof raw.researchRecommendation === "string" ? raw.researchRecommendation : void 0;
286
+ if (!generatedAt && !summary && !recommendation) return null;
287
+ return { generatedAt, summary, recommendation };
288
+ };
289
+ const resolveBespokeSnapshot = async (input) => {
290
+ const fromConfig = await config.autonomy?.intentPolicy?.bespokeGate?.resolveSnapshot?.(input);
291
+ if (fromConfig) return fromConfig;
292
+ const raw = input.snapshot;
293
+ const bespokeKey = typeof raw.bespokeKey === "string" ? raw.bespokeKey : typeof raw.builderBespokeKey === "string" ? raw.builderBespokeKey : void 0;
294
+ const divergedFromTemplate = typeof raw.divergedFromTemplate === "boolean" ? raw.divergedFromTemplate : typeof raw.builderDivergedFromTemplate === "boolean" ? raw.builderDivergedFromTemplate : void 0;
295
+ const noveltyRaw = typeof raw.noveltyScore === "number" ? raw.noveltyScore : typeof raw.builderNoveltyScore === "number" ? raw.builderNoveltyScore : void 0;
296
+ const noveltyScore = Number.isFinite(noveltyRaw) ? Number(noveltyRaw) : void 0;
297
+ if (!bespokeKey && typeof divergedFromTemplate === "undefined" && typeof noveltyScore === "undefined") return null;
298
+ return { bespokeKey, divergedFromTemplate, noveltyScore };
299
+ };
275
300
  const runOnce = async () => {
276
301
  try {
277
302
  const memoryUpgrade = await ensureMemoryUpgrade();
@@ -409,6 +434,8 @@ var createAgentLoop = (config) => {
409
434
  }
410
435
  }
411
436
  arbitrationBase.autonomousTaskKind = arbitrationBase.runAutonomousTask && !humanDemand.pending ? "build_new_product" : "polish_existing_product";
437
+ const researchSnapshot = await resolveResearchSnapshot({ snapshot, survivalMode, humanDemand });
438
+ const bespokeSnapshot = await resolveBespokeSnapshot({ snapshot, survivalMode, humanDemand });
412
439
  const ctx = {
413
440
  snapshot,
414
441
  survivalState,
@@ -427,6 +454,8 @@ var createAgentLoop = (config) => {
427
454
  objectiveGuardDecision,
428
455
  workArbitration: arbitrationBase,
429
456
  laneDecision,
457
+ researchSnapshot: researchSnapshot || void 0,
458
+ bespokeSnapshot: bespokeSnapshot || void 0,
430
459
  timestamp
431
460
  };
432
461
  if (hooks.onCycle) await hooks.onCycle(ctx);
@@ -459,6 +488,30 @@ var createAgentLoop = (config) => {
459
488
  if (objectiveGuardEnabled && objectiveGuardMode === "enforce" && ctx.objectiveGuardDecision && !ctx.objectiveGuardDecision.allowObjectiveChange) {
460
489
  throw new Error(`objective_guard_blocked:${ctx.objectiveGuardDecision.reason}`);
461
490
  }
491
+ if (rolloutMode === "enforce" && researchGateEnabled && ctx.workArbitration?.runAutonomousTask && ctx.workArbitration?.autonomousTaskKind === "build_new_product") {
492
+ const generatedAt = ctx.researchSnapshot?.generatedAt;
493
+ const hasResearch = Boolean(generatedAt || ctx.researchSnapshot?.summary || ctx.researchSnapshot?.recommendation);
494
+ if (!hasResearch) {
495
+ throw new Error("research_gate_blocked:missing_research_snapshot");
496
+ }
497
+ if (generatedAt) {
498
+ const ageMs = Date.now() - Date.parse(generatedAt);
499
+ if (!Number.isFinite(ageMs) || ageMs > researchGateMaxAgeMs) {
500
+ throw new Error("research_gate_blocked:stale_research_snapshot");
501
+ }
502
+ }
503
+ }
504
+ if (rolloutMode === "enforce" && bespokeGateEnabled && ctx.workArbitration?.runAutonomousTask && ctx.workArbitration?.autonomousTaskKind === "build_new_product") {
505
+ if (!ctx.bespokeSnapshot?.bespokeKey) {
506
+ throw new Error("bespoke_gate_blocked:missing_bespoke_key");
507
+ }
508
+ if (ctx.bespokeSnapshot?.divergedFromTemplate !== true) {
509
+ throw new Error("bespoke_gate_blocked:not_diverged_from_template");
510
+ }
511
+ if (typeof ctx.bespokeSnapshot?.noveltyScore === "number" && ctx.bespokeSnapshot.noveltyScore < bespokeGateMinNovelty) {
512
+ throw new Error("bespoke_gate_blocked:novelty_below_threshold");
513
+ }
514
+ }
462
515
  if (autonomyEnabled && config.autonomy?.onAutonomous && rolloutMode === "enforce") {
463
516
  if (ctx.workArbitration?.runHumanTask) await runHumanTask();
464
517
  if (ctx.workArbitration?.runAutonomousTask) await runAutonomousTask();
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { MarketDiscoveryClient, MarketNeed, MarketSignal, deriveMarketNeeds, dis
9
9
  export { A as AdapterBestShotChecklistResult, a as AdapterPackKind, b as AdapterPackOptions, c as AdaptiveAdaptationPlan, d as AdaptiveExecution, e as AdaptiveFeedbackAggregate, f as AdaptivePolicyConfig, g as AdaptivePolicyDecision, h as AdaptivePolicyState, i as AdaptiveReflectionStore, j as AdaptiveTheme, k as AdaptiveVerification, l as AgentLaunchRuntimeOptions, m as AgentLaunchRuntimeResult, n as AgentResourceProvidersManifest, o as AgentReviewRuntimeOptions, p as AnalyticsPoint, q as ApiCreditProvider, r as ApiCreditProviderFactoryOptions, s as ApiCreditProviderPreset, t as ApiCreditProviderPresetInput, u as ApiResponse, B as BuybackEvent, C as CONTEXT_PACK_SECTION_ORDER, v as ContextPack, w as ContextPackBudget, x as ContextPackGateOptions, y as ContextPackGateResult, z as ContextPackInput, D as ContextPackOptions, E as ContextPackSectionKey, F as ContextPackSections, G as ContextPackState, H as DurabilityCheckpointWriteOptions, I as DurabilityProxyClientOptions, J as DurabilityRestoreDrillWriteOptions, K as ExecutionAdapter, L as ExecutionApplyResult, M as ExecutionDecisionRecord, N as ExecutionDryRunResult, O as ExecutionPostDeployVerifyResult, P as ExecutionRollbackResult, Q as ExecutionRolloutMode, R as ExecutionRunResult, S as ExecutionValidateResult, T as LISTING_NAME_MAX_LENGTH, U as LISTING_NAME_RECOMMENDED_MAX, V as LISTING_TAGLINE_MAX_LENGTH, W as LISTING_TAGLINE_RECOMMENDED_MAX, X as LaunchProfile, Y as LaunchReadinessInput, Z as LaunchReadinessResult, _ as LeaderboardEntry, $ as LeaderboardQuery, a0 as ListingNamingValidationOptions, a1 as ListingNamingValidationResult, a2 as ListingQuery, a3 as ListingReviewCreatePayload, a4 as ListingReviewResponsePayload, a5 as ListingVersionPayload, a6 as MarketingCampaign, a7 as MarketingLinkOptions, a8 as MemoryPingChallengeResponse, a9 as MemoryPingPayload, aa as OpenRouterCredits, ab as ProcurementCandidate, ac as ProcurementDecision, ad as ProcurementTaskProfile, ae as ProcurementWeights, af as ResourceProviderManifestEntry, ag as ResourceSnapshot, ah as ReviewGate, ai as ReviewGateRecord, aj as ReviewRequiredPayload, ak as RunAdaptiveReflectionOptions, al as RuntimeMigrationInput, am as RuntimeMigrationPlan, an as RuntimeStateSnapshot, ao as SdkAutoUpdatedRestartRequiredError, ap as SdkUpdateCheckOptions, aq as SdkUpdatePolicyCheckOptions, ar as SdkUpdateRequiredError, as as SdkUpdateStatus, TopupDecision, TopupRequest, TreasuryLedgerEvent, TreasuryPolicy, TreasuryPolicyV1, TreasuryState, at as VIBEIAO_IDL, au as VibeClient, av as VibeClientOptions, aw as VibeRegistry, ax as aggregateFeedbackSignals, ay as assertLaunchReady, az as assertSurvivalProvidersConfigured, aA as buildAdaptivePlan, aB as buildBadgeMarkdown, aC as buildClaimMessage, aD as buildDecisionRecord, aE as buildJupiterSwapUrl, aF as buildListingVersionMessage, aG as buildMemoryPingMessage, aH as buildOwnerTransferMessage, aI as buildProcurementPrompt, aJ as buildRaydiumSwapUrl, aK as buildReviewPrompt, aL as buildReviewRequired, aM as buildReviewResponseMessage, aN as buildRuntimeMigrationPlan, aO as buildSdkUpdateCommand, aP as buildShareCopy, aQ as buildShareLink, aR as buildTradeLinks, buildTreasuryLedgerEvent, aS as checkForSdkUpdate, aT as checkForSdkUpdatePolicy, aU as compareVersions, aV as createApiCreditProvider, aW as createApiCreditProviders, aX as createApiCreditProvidersFromManifest, aY as createCampaign, aZ as createContextPack, a_ as createCustomAdapter, a$ as createDurabilityProxyClient, b0 as createServiceApiAdapter, createTreasuryPolicy, b1 as createWebBundledAdapter, b2 as createWebStaticAdapter, b3 as createWorkflowAgentAdapter, b4 as decideProcurementForTask, b5 as estimateContextPackTokens, b6 as evaluateAdaptiveReflectionPolicy, b7 as evaluateContextPackGate, b8 as evaluateLaunchReadiness, evaluateTopupRequest, b9 as getResourceSnapshot, ba as normalizeListingText, bb as rankListingsForTask, bc as runAdapterBestShotChecklist, bd as runAdaptiveReflectionCycle, be as runAgentLaunchRuntime, bf as runAgentLaunchRuntimeCycle, bg as runAgentReviewRuntimeCycle, bh as runExecutionAdapter, bi as sanitizeListingNaming, bj as scoreListingForTask, bk as shouldAnnounceStateChange, treasuryStateFromSnapshot, bl as validateContextPack, bm as validateListingNaming, validateTreasuryPolicy, bn as verifyAdaptiveExecutionReadiness } from './treasuryGuardian.js';
10
10
  export { OUTCOME_BOUND_FLOW_SCHEMA, OUTCOME_BOUND_REQUIRED_GATES, OutcomeBoundRequiredGate, OutcomeBoundRunInput, OutcomeBoundRunStatus, assertOutcomeBoundCompleted, evaluateOutcomeBoundRun } from './outcomeBoundFlow.js';
11
11
  export { STRICT_MEMORY_RUNTIME_SCHEMA, StrictMemoryEvaluation, StrictMemoryEvaluationInput, StrictMemoryRuntimePreset, StrictMemoryTriggerSet, StrictMemoryUpgradeInput, StrictMemoryUpgradePolicy, StrictMemoryUpgradeResult, createStrictMemoryRuntimePreset, evaluateStrictMemoryExecution, isComplexTask, upgradeToStrictMemoryRuntimePreset } from './strictMemoryRuntime.js';
12
- export { I as IntentSignals, L as LaneMode, a as LaneSwitchDecision, O as ObjectiveChangeProposal, b as ObjectiveChangeSourceTrust, c as ObjectiveGuardDecision, d as ObjectiveGuardPolicy, P as PromptShieldDecision, e as PromptShieldFlag, f as PromptShieldInput, g as PromptShieldPolicy, h as PromptShieldRisk, i as PromptShieldTrustLevel, j as applyIntentArbitration, k as evaluateLaneSwitch, l as evaluateObjectiveChange, m as evaluatePromptShield, s as scoreBuildLane, n as scorePolishLane } from './agentLoop-D394RDif.js';
12
+ export { I as IntentSignals, L as LaneMode, a as LaneSwitchDecision, O as ObjectiveChangeProposal, b as ObjectiveChangeSourceTrust, c as ObjectiveGuardDecision, d as ObjectiveGuardPolicy, P as PromptShieldDecision, e as PromptShieldFlag, f as PromptShieldInput, g as PromptShieldPolicy, h as PromptShieldRisk, i as PromptShieldTrustLevel, j as applyIntentArbitration, k as evaluateLaneSwitch, l as evaluateObjectiveChange, m as evaluatePromptShield, s as scoreBuildLane, n as scorePolishLane } from './agentLoop-DAkl2g28.js';
13
13
  export { fetchSolBalance, fetchTokenBalance, fetchTokenBalances } from './solana.js';
14
14
  import './compoundingMemory.js';
15
15
  import '@coral-xyz/anchor';
package/dist/index.js CHANGED
@@ -1112,7 +1112,7 @@ var ReviewGate = class {
1112
1112
  var DEFAULT_API_BASE = "https://api.vibeiao.com";
1113
1113
  var DEFAULT_WEB_BASE = "https://vibeiao.com";
1114
1114
  var DEFAULT_SDK_PACKAGE = "@vibeiao/sdk";
1115
- var DEFAULT_SDK_VERSION = "0.1.53" ? "0.1.53" : "0.1.4";
1115
+ var DEFAULT_SDK_VERSION = "0.1.55" ? "0.1.55" : "0.1.4";
1116
1116
  var DEFAULT_SDK_REGISTRY = "https://registry.npmjs.org";
1117
1117
  var DEFAULT_SDK_POLICY_PATH = "/v1/sdk/policy";
1118
1118
  var DEFAULT_SDK_CHECK_INTERVAL_MS = 1e3 * 60 * 30;
@@ -8,7 +8,7 @@ import './survivalEscapeHatch.js';
8
8
  import './marketDiscovery.js';
9
9
  import './outcomeBoundFlow.js';
10
10
  import './strictMemoryRuntime.js';
11
- import './agentLoop-D394RDif.js';
11
+ import './agentLoop-DAkl2g28.js';
12
12
  import './solana.js';
13
13
  import './compoundingMemory.js';
14
14
  import '@coral-xyz/anchor';
@@ -1474,7 +1474,7 @@ declare class ReviewGate {
1474
1474
  assertClear(listingId: string, wallet: string): void;
1475
1475
  }
1476
1476
 
1477
- declare const compareVersions: (currentVersion: string, latestVersion: string) => 0 | 1 | -1;
1477
+ declare const compareVersions: (currentVersion: string, latestVersion: string) => 1 | 0 | -1;
1478
1478
  declare const buildSdkUpdateCommand: (packageName?: string) => string;
1479
1479
  declare const checkForSdkUpdate: (options?: SdkUpdateCheckOptions) => Promise<SdkUpdateStatus>;
1480
1480
  declare const checkForSdkUpdatePolicy: (options: SdkUpdatePolicyCheckOptions) => Promise<SdkUpdateStatus>;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@vibeiao/sdk",
3
3
  "private": false,
4
4
  "type": "module",
5
- "version": "0.1.54",
5
+ "version": "0.1.56",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "exports": {