@vibeiao/sdk 0.1.45 → 0.1.47

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 CHANGED
@@ -689,6 +689,7 @@ Adaptive reflection policy is available for cadence-based adaptation (not per-re
689
689
  - aggregate feedback over time windows and score recurring themes
690
690
  - evaluate thresholds + cooldown + daily adaptation caps
691
691
  - output `hold|observe|adapt` decision and optional bounded adaptation plan
692
+ - enforce `verify -> execute` sequencing in apply mode (no verify pass => no execution)
692
693
 
693
694
  You can also enforce dual-mode work arbitration:
694
695
  - `owner_bound` agents: human-first (owner work preempts autonomous work)
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { SurvivalMode, SurvivalRecommendation, classifySurvivalMode, formatSurvi
6
6
  export { SurvivalIntegrationDecision, getSurvivalPlaybookDecision, getSurvivalPlaybookDecisionFromSelfReliance } from './survivalIntegration.js';
7
7
  export { EscapeHatchDecision, EscapeHatchPolicy, EscapeHatchSnapshot, evaluateEscapeHatch, formatEscapeHatchDecision } from './survivalEscapeHatch.js';
8
8
  export { MarketDiscoveryClient, MarketNeed, MarketSignal, deriveMarketNeeds, discoverMarketNeeds, extractMarketSignals, runMarketDiscovery } from './marketDiscovery.js';
9
- export { A as AdaptiveAdaptationPlan, a as AdaptiveFeedbackAggregate, b as AdaptivePolicyConfig, c as AdaptivePolicyDecision, d as AdaptivePolicyState, e as AdaptiveReflectionStore, f as AdaptiveTheme, g as AgentResourceProvidersManifest, h as AnalyticsPoint, i as ApiCreditProvider, j as ApiCreditProviderFactoryOptions, k as ApiCreditProviderPreset, l as ApiCreditProviderPresetInput, m as ApiResponse, B as BuybackEvent, C as CONTEXT_PACK_SECTION_ORDER, n as ContextPack, o as ContextPackBudget, p as ContextPackInput, q as ContextPackOptions, r as ContextPackSectionKey, s as ContextPackSections, D as DurabilityCheckpointWriteOptions, t as DurabilityProxyClientOptions, u as DurabilityRestoreDrillWriteOptions, L as LISTING_NAME_MAX_LENGTH, v as LISTING_NAME_RECOMMENDED_MAX, w as LISTING_TAGLINE_MAX_LENGTH, x as LISTING_TAGLINE_RECOMMENDED_MAX, y as LeaderboardEntry, z as LeaderboardQuery, E as ListingNamingValidationOptions, F as ListingNamingValidationResult, G as ListingQuery, H as ListingReviewCreatePayload, I as ListingReviewResponsePayload, J as ListingVersionPayload, M as MarketingCampaign, K as MarketingLinkOptions, N as MemoryPingChallengeResponse, O as MemoryPingPayload, P as OpenRouterCredits, Q as ProcurementCandidate, R as ProcurementDecision, S as ProcurementTaskProfile, T as ProcurementWeights, U as ResourceProviderManifestEntry, V as ResourceSnapshot, W as ReviewGate, X as ReviewGateRecord, Y as ReviewRequiredPayload, Z as RunAdaptiveReflectionOptions, _ as SdkAutoUpdatedRestartRequiredError, $ as SdkUpdateCheckOptions, a0 as SdkUpdatePolicyCheckOptions, a1 as SdkUpdateRequiredError, a2 as SdkUpdateStatus, TopupDecision, TopupRequest, TreasuryLedgerEvent, TreasuryPolicy, TreasuryPolicyV1, TreasuryState, a3 as VIBEIAO_IDL, a4 as VibeClient, a5 as VibeClientOptions, a6 as VibeRegistry, a7 as aggregateFeedbackSignals, a8 as assertSurvivalProvidersConfigured, a9 as buildAdaptivePlan, aa as buildBadgeMarkdown, ab as buildClaimMessage, ac as buildJupiterSwapUrl, ad as buildListingVersionMessage, ae as buildMemoryPingMessage, af as buildOwnerTransferMessage, ag as buildProcurementPrompt, ah as buildRaydiumSwapUrl, ai as buildReviewPrompt, aj as buildReviewRequired, ak as buildReviewResponseMessage, al as buildSdkUpdateCommand, am as buildShareCopy, an as buildShareLink, ao as buildTradeLinks, buildTreasuryLedgerEvent, ap as checkForSdkUpdate, aq as checkForSdkUpdatePolicy, ar as compareVersions, as as createApiCreditProvider, at as createApiCreditProviders, au as createApiCreditProvidersFromManifest, av as createCampaign, aw as createContextPack, ax as createDurabilityProxyClient, createTreasuryPolicy, ay as decideProcurementForTask, az as estimateContextPackTokens, aA as evaluateAdaptiveReflectionPolicy, evaluateTopupRequest, aB as getResourceSnapshot, aC as normalizeListingText, aD as rankListingsForTask, aE as runAdaptiveReflectionCycle, aF as sanitizeListingNaming, aG as scoreListingForTask, treasuryStateFromSnapshot, aH as validateContextPack, aI as validateListingNaming, validateTreasuryPolicy } from './treasuryGuardian.js';
9
+ export { A as AdaptiveAdaptationPlan, a as AdaptiveExecution, b as AdaptiveFeedbackAggregate, c as AdaptivePolicyConfig, d as AdaptivePolicyDecision, e as AdaptivePolicyState, f as AdaptiveReflectionStore, g as AdaptiveTheme, h as AdaptiveVerification, i as AgentResourceProvidersManifest, j as AgentReviewRuntimeOptions, k as AnalyticsPoint, l as ApiCreditProvider, m as ApiCreditProviderFactoryOptions, n as ApiCreditProviderPreset, o as ApiCreditProviderPresetInput, p as ApiResponse, B as BuybackEvent, C as CONTEXT_PACK_SECTION_ORDER, q as ContextPack, r as ContextPackBudget, s as ContextPackInput, t as ContextPackOptions, u as ContextPackSectionKey, v as ContextPackSections, D as DurabilityCheckpointWriteOptions, w as DurabilityProxyClientOptions, x as DurabilityRestoreDrillWriteOptions, E as ExecutionAdapter, y as ExecutionApplyResult, z as ExecutionDecisionRecord, F as ExecutionDryRunResult, G as ExecutionRollbackResult, H as ExecutionRolloutMode, I as ExecutionRunResult, J as ExecutionValidateResult, L as LISTING_NAME_MAX_LENGTH, K as LISTING_NAME_RECOMMENDED_MAX, M as LISTING_TAGLINE_MAX_LENGTH, N as LISTING_TAGLINE_RECOMMENDED_MAX, O as LeaderboardEntry, P as LeaderboardQuery, Q as ListingNamingValidationOptions, R as ListingNamingValidationResult, S as ListingQuery, T as ListingReviewCreatePayload, U as ListingReviewResponsePayload, V as ListingVersionPayload, W as MarketingCampaign, X as MarketingLinkOptions, Y as MemoryPingChallengeResponse, Z as MemoryPingPayload, _ as OpenRouterCredits, $ as ProcurementCandidate, a0 as ProcurementDecision, a1 as ProcurementTaskProfile, a2 as ProcurementWeights, a3 as ResourceProviderManifestEntry, a4 as ResourceSnapshot, a5 as ReviewGate, a6 as ReviewGateRecord, a7 as ReviewRequiredPayload, a8 as RunAdaptiveReflectionOptions, a9 as SdkAutoUpdatedRestartRequiredError, aa as SdkUpdateCheckOptions, ab as SdkUpdatePolicyCheckOptions, ac as SdkUpdateRequiredError, ad as SdkUpdateStatus, TopupDecision, TopupRequest, TreasuryLedgerEvent, TreasuryPolicy, TreasuryPolicyV1, TreasuryState, ae as VIBEIAO_IDL, af as VibeClient, ag as VibeClientOptions, ah as VibeRegistry, ai as aggregateFeedbackSignals, aj as assertSurvivalProvidersConfigured, ak as buildAdaptivePlan, al as buildBadgeMarkdown, am as buildClaimMessage, an as buildDecisionRecord, ao as buildJupiterSwapUrl, ap as buildListingVersionMessage, aq as buildMemoryPingMessage, ar as buildOwnerTransferMessage, as as buildProcurementPrompt, at as buildRaydiumSwapUrl, au as buildReviewPrompt, av as buildReviewRequired, aw as buildReviewResponseMessage, ax as buildSdkUpdateCommand, ay as buildShareCopy, az as buildShareLink, aA as buildTradeLinks, buildTreasuryLedgerEvent, aB as checkForSdkUpdate, aC as checkForSdkUpdatePolicy, aD as compareVersions, aE as createApiCreditProvider, aF as createApiCreditProviders, aG as createApiCreditProvidersFromManifest, aH as createCampaign, aI as createContextPack, aJ as createDurabilityProxyClient, createTreasuryPolicy, aK as decideProcurementForTask, aL as estimateContextPackTokens, aM as evaluateAdaptiveReflectionPolicy, evaluateTopupRequest, aN as getResourceSnapshot, aO as normalizeListingText, aP as rankListingsForTask, aQ as runAdaptiveReflectionCycle, aR as runAgentReviewRuntimeCycle, aS as runExecutionAdapter, aT as sanitizeListingNaming, aU as scoreListingForTask, treasuryStateFromSnapshot, aV as validateContextPack, aW as validateListingNaming, validateTreasuryPolicy, aX 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
12
  export { d as ObjectiveChangeProposal, e as ObjectiveChangeSourceTrust, O as ObjectiveGuardDecision, c as ObjectiveGuardPolicy, P as PromptShieldDecision, f as PromptShieldFlag, b as PromptShieldInput, a as PromptShieldPolicy, g as PromptShieldRisk, h as PromptShieldTrustLevel, i as evaluateObjectiveChange, j as evaluatePromptShield } from './objectiveGuard-d1x0xgAD.js';
package/dist/index.js CHANGED
@@ -248,6 +248,63 @@ var validateContextPack = (value) => {
248
248
  var CONTEXT_PACK_SECTION_ORDER = [...SECTION_ORDER];
249
249
  var estimateContextPackTokens = (textOrChars) => estimateTokensFromChars(typeof textOrChars === "number" ? textOrChars : textOrChars.length);
250
250
 
251
+ // src/executionAdapter.ts
252
+ var buildDecisionRecord = (input) => {
253
+ const nowMs = input.nowMs ?? Date.now();
254
+ return {
255
+ id: `decision-${nowMs}-${Math.random().toString(36).slice(2, 8)}`,
256
+ createdAt: new Date(nowMs).toISOString(),
257
+ decision: input.decision,
258
+ confidence: input.confidence,
259
+ verified: input.verified,
260
+ reasons: input.reasons,
261
+ objective: input.objective
262
+ };
263
+ };
264
+ var runExecutionAdapter = async (input) => {
265
+ const { mode, record, adapter } = input;
266
+ if (mode === "observe") {
267
+ return { mode, attempted: false, applied: false, validated: false, rolledBack: false, reason: "observe_mode" };
268
+ }
269
+ if (!adapter) {
270
+ return { mode, attempted: false, applied: false, validated: false, rolledBack: false, reason: "no_adapter" };
271
+ }
272
+ const dryRun = await adapter.dryRun({ record });
273
+ if (!dryRun.feasible) {
274
+ return { mode, attempted: false, applied: false, validated: false, rolledBack: false, reason: `dry_run_failed:${dryRun.reasons.join(",")}`, dryRun };
275
+ }
276
+ if (mode === "shadow") {
277
+ return { mode, attempted: true, applied: false, validated: false, rolledBack: false, reason: "shadow_mode", dryRun };
278
+ }
279
+ if (mode === "apply_limited" && record.confidence < 0.85) {
280
+ return { mode, attempted: true, applied: false, validated: false, rolledBack: false, reason: "limited_mode_confidence_gate", dryRun };
281
+ }
282
+ const apply = await adapter.apply({ record });
283
+ if (!apply.applied) {
284
+ return { mode, attempted: true, applied: false, validated: false, rolledBack: false, reason: apply.reason || "apply_not_applied", dryRun, apply };
285
+ }
286
+ const validate = await adapter.validate({ record, apply });
287
+ if (validate.passed) {
288
+ return { mode, attempted: true, applied: true, validated: true, rolledBack: false, reason: "applied_and_validated", dryRun, apply, validate };
289
+ }
290
+ if (adapter.rollback) {
291
+ const rollback = await adapter.rollback({ record, apply, validate });
292
+ return {
293
+ mode,
294
+ attempted: true,
295
+ applied: true,
296
+ validated: false,
297
+ rolledBack: rollback.rolledBack,
298
+ reason: rollback.rolledBack ? "rolled_back_after_validation_fail" : "validation_fail_rollback_failed",
299
+ dryRun,
300
+ apply,
301
+ validate,
302
+ rollback
303
+ };
304
+ }
305
+ return { mode, attempted: true, applied: true, validated: false, rolledBack: false, reason: "validation_failed_no_rollback", dryRun, apply, validate };
306
+ };
307
+
251
308
  // src/adaptiveReflection.ts
252
309
  var clamp01 = (n) => Math.max(0, Math.min(1, n));
253
310
  var recencyWeight = (createdAt, nowMs) => {
@@ -262,18 +319,20 @@ var recencyWeight = (createdAt, nowMs) => {
262
319
  };
263
320
  var inferTheme = (r) => {
264
321
  const t = `${String(r.comment || "")} ${String(r.agent_response_comment || "")}`.toLowerCase();
265
- if (/bug|broken|error|crash|fail/.test(t)) return "bug";
322
+ const rating = Number(r.rating);
323
+ if (/bug|broken|error|crash|fail|trash|awful|terrible|unplayable|unusable|only a page of code|only code|don\'t see any game|dont see any game|no game/.test(t)) return "bug";
266
324
  if (/downtime|timeout|unavailable|latency|disconnect/.test(t)) return "reliability";
267
325
  if (/confusing|hard|ux|ui|friction/.test(t)) return "ux";
268
326
  if (/price|expensive|cost|value/.test(t)) return "pricing";
269
327
  if (/feature|add|request|support/.test(t)) return "feature";
270
328
  if (/great|love|awesome|excellent/.test(t)) return "praise";
329
+ if (Number.isFinite(rating) && rating <= 2) return "bug";
271
330
  return "noise";
272
331
  };
273
332
  var classifyIssueSignal = (r) => {
274
333
  const text = `${String(r.comment || "")} ${String(r.agent_response_comment || "")}`.toLowerCase();
275
334
  const rating = Number(r.rating);
276
- const criticalHint = /crash|broken|error|fail|unusable|cannot|can't|doesn't work|not work|timeout|data loss/.test(text);
335
+ const criticalHint = /crash|broken|error|fail|trash|awful|terrible|unplayable|unusable|cannot|can't|doesn't work|not work|timeout|data loss|only a page of code|only code|don\'t see any game|dont see any game|no game/.test(text);
277
336
  const prefHint = /prefer|would like|i wish|could you|nice to have|personally|for me/.test(text);
278
337
  if (criticalHint || Number.isFinite(rating) && rating <= 2 && /bug|reliability|ux|pricing|feature/.test(inferTheme(r))) {
279
338
  return "critical_issue";
@@ -354,7 +413,7 @@ var evaluateAdaptiveReflectionPolicy = (aggregate, state, policy = {}, nowMs = D
354
413
  return { decision: "hold", immediate: false, rationale, confidence: 0.85, topTheme: aggregate.topTheme, topScore: aggregate.topScore };
355
414
  }
356
415
  const top = aggregate.themes.find((t) => t.theme === aggregate.topTheme);
357
- const immediate = Boolean(top && (top.theme === "bug" || top.theme === "reliability") && top.criticalCount >= 2 && top.weightedScore >= Math.max(3, minTopScore));
416
+ const immediate = Boolean(top && (top.theme === "bug" || top.theme === "reliability") && top.criticalCount >= 1 && top.weightedScore >= Math.max(2.2, minTopScore));
358
417
  if (immediate) rationale.push("immediate_fix_recommended");
359
418
  rationale.push("aggregate_signal_passed");
360
419
  return { decision: "adapt", immediate, rationale, confidence: immediate ? 0.9 : 0.8, topTheme: aggregate.topTheme, topScore: aggregate.topScore };
@@ -408,6 +467,32 @@ var buildAdaptivePlan = (decision) => {
408
467
  };
409
468
  return { id, theme: decision.topTheme, ...byTheme[decision.topTheme], urgency: decision.immediate ? "immediate" : "normal" };
410
469
  };
470
+ var verifyAdaptiveExecutionReadiness = (input, options = {}) => {
471
+ const minConfidence = options.minConfidence ?? 0.75;
472
+ const reasons = [];
473
+ const hasPlan = Boolean(input.plan);
474
+ if (!hasPlan) reasons.push("missing_plan");
475
+ const confidenceOk = input.decision.confidence >= minConfidence;
476
+ if (!confidenceOk) reasons.push("confidence_below_threshold");
477
+ const notNoiseTheme = input.decision.topTheme !== "noise";
478
+ if (!notNoiseTheme) reasons.push("noise_theme_blocked");
479
+ const policyAllowsAdapt = input.decision.decision === "adapt";
480
+ if (!policyAllowsAdapt) reasons.push("policy_not_adapt");
481
+ const allowImmediateOnly = options.allowImmediateOnly ?? false;
482
+ const urgencyAllowed = !allowImmediateOnly || Boolean(input.decision.immediate);
483
+ if (!urgencyAllowed) reasons.push("immediate_required");
484
+ return {
485
+ passed: hasPlan && confidenceOk && notNoiseTheme && policyAllowsAdapt && urgencyAllowed,
486
+ checks: {
487
+ hasPlan,
488
+ confidenceOk,
489
+ notNoiseTheme,
490
+ policyAllowsAdapt,
491
+ urgencyAllowed
492
+ },
493
+ reasons
494
+ };
495
+ };
411
496
  var runAdaptiveReflectionCycle = async (opts) => {
412
497
  const now = opts.now || (() => Date.now());
413
498
  const nowMs = now();
@@ -420,6 +505,13 @@ var runAdaptiveReflectionCycle = async (opts) => {
420
505
  });
421
506
  const decision = evaluateAdaptiveReflectionPolicy(aggregate, state, opts.policy, nowMs);
422
507
  const plan = buildAdaptivePlan(decision);
508
+ const verification = verifyAdaptiveExecutionReadiness(
509
+ { decision, plan },
510
+ {
511
+ minConfidence: 0.75,
512
+ allowImmediateOnly: opts.execution?.allowImmediateOnly ?? false
513
+ }
514
+ );
423
515
  const reflection = await runReflectionCycle({
424
516
  client: opts.client,
425
517
  listingId: opts.listingId,
@@ -428,11 +520,57 @@ var runAdaptiveReflectionCycle = async (opts) => {
428
520
  store: opts.reflectionStore,
429
521
  ...opts.reflectionOptions || {}
430
522
  });
523
+ const mode = opts.execution?.mode ?? "observe";
524
+ const rolloutMode = opts.execution?.rolloutMode || (mode === "apply" ? "apply_full" : "observe");
525
+ let execution = {
526
+ attempted: false,
527
+ applied: false,
528
+ mode,
529
+ reason: mode === "apply" ? "awaiting_verification" : "observe_mode"
530
+ };
531
+ if (mode === "apply") {
532
+ if (!verification.passed) {
533
+ execution = {
534
+ attempted: false,
535
+ applied: false,
536
+ mode,
537
+ reason: `verify_failed:${verification.reasons.join(",")}`
538
+ };
539
+ } else if (opts.execution?.adapter && plan) {
540
+ const record = buildDecisionRecord({
541
+ decision: decision.decision,
542
+ confidence: decision.confidence,
543
+ verified: verification.passed,
544
+ reasons: verification.reasons,
545
+ objective: plan.objectiveDelta,
546
+ nowMs
547
+ });
548
+ const run = await runExecutionAdapter({
549
+ mode: rolloutMode,
550
+ record,
551
+ adapter: opts.execution.adapter
552
+ });
553
+ execution = {
554
+ attempted: run.attempted,
555
+ applied: run.applied,
556
+ mode,
557
+ reason: run.reason
558
+ };
559
+ } else {
560
+ execution = {
561
+ attempted: false,
562
+ applied: false,
563
+ mode,
564
+ reason: "no_execution_adapter"
565
+ };
566
+ }
567
+ }
431
568
  const next = {
432
569
  ...state,
433
570
  lastEvaluatedAt: nowMs
434
571
  };
435
- if (decision.decision === "adapt" && plan) {
572
+ const adaptationCounted = decision.decision === "adapt" && plan && (mode === "observe" || execution.applied);
573
+ if (adaptationCounted) {
436
574
  next.lastAdaptedAtByTheme = { ...state.lastAdaptedAtByTheme || {}, [plan.theme]: nowMs };
437
575
  next.adaptationEvents = [...state.adaptationEvents || [], { ts: nowMs, theme: plan.theme, actionId: plan.id }].slice(-500);
438
576
  }
@@ -443,12 +581,37 @@ var runAdaptiveReflectionCycle = async (opts) => {
443
581
  generatedAt: new Date(nowMs).toISOString(),
444
582
  aggregate,
445
583
  decision,
584
+ verification,
585
+ execution,
446
586
  plan,
447
587
  reflection,
448
588
  policyState: next
449
589
  };
450
590
  };
451
591
 
592
+ // src/agentReviewRuntime.ts
593
+ var runAgentReviewRuntimeCycle = async (opts) => {
594
+ if (!opts.adapter) {
595
+ throw new Error("agent_review_runtime_requires_execution_adapter");
596
+ }
597
+ return runAdaptiveReflectionCycle({
598
+ client: opts.client,
599
+ listingId: opts.listingId,
600
+ wallet: opts.wallet,
601
+ signMessage: opts.signMessage,
602
+ reflectionStore: opts.reflectionStore,
603
+ policy: opts.policy,
604
+ reflectionOptions: opts.reflectionOptions,
605
+ execution: {
606
+ mode: "apply",
607
+ rolloutMode: opts.rolloutMode || "apply_full",
608
+ allowImmediateOnly: opts.allowImmediateOnly ?? false,
609
+ adapter: opts.adapter
610
+ },
611
+ now: opts.now
612
+ });
613
+ };
614
+
452
615
  // src/index.ts
453
616
  var SdkUpdateRequiredError = class extends Error {
454
617
  status;
@@ -565,7 +728,7 @@ var ReviewGate = class {
565
728
  var DEFAULT_API_BASE = "https://api.vibeiao.com";
566
729
  var DEFAULT_WEB_BASE = "https://vibeiao.com";
567
730
  var DEFAULT_SDK_PACKAGE = "@vibeiao/sdk";
568
- var DEFAULT_SDK_VERSION = "0.1.44" ? "0.1.44" : "0.1.4";
731
+ var DEFAULT_SDK_VERSION = "0.1.46" ? "0.1.46" : "0.1.4";
569
732
  var DEFAULT_SDK_REGISTRY = "https://registry.npmjs.org";
570
733
  var DEFAULT_SDK_POLICY_PATH = "/v1/sdk/policy";
571
734
  var DEFAULT_SDK_CHECK_INTERVAL_MS = 1e3 * 60 * 30;
@@ -1702,6 +1865,7 @@ export {
1702
1865
  buildAdaptivePlan,
1703
1866
  buildBadgeMarkdown,
1704
1867
  buildClaimMessage,
1868
+ buildDecisionRecord,
1705
1869
  buildJupiterSwapUrl,
1706
1870
  buildListingVersionMessage,
1707
1871
  buildMemoryPingMessage,
@@ -1762,6 +1926,8 @@ export {
1762
1926
  normalizeListingText,
1763
1927
  rankListingsForTask,
1764
1928
  runAdaptiveReflectionCycle,
1929
+ runAgentReviewRuntimeCycle,
1930
+ runExecutionAdapter,
1765
1931
  runMarketDiscovery,
1766
1932
  runReflectionCycle,
1767
1933
  sanitizeListingNaming,
@@ -1772,5 +1938,6 @@ export {
1772
1938
  validateContextPack,
1773
1939
  validateListingNaming,
1774
1940
  validateTreasuryPolicy,
1941
+ verifyAdaptiveExecutionReadiness,
1775
1942
  withSurvival
1776
1943
  };
@@ -828,6 +828,77 @@ declare const createDurabilityProxyClient: (options: DurabilityProxyClientOption
828
828
  }>;
829
829
  };
830
830
 
831
+ type ExecutionRolloutMode = 'observe' | 'shadow' | 'apply_limited' | 'apply_full';
832
+ type ExecutionDecisionRecord = {
833
+ id: string;
834
+ createdAt: string;
835
+ decision: 'hold' | 'observe' | 'adapt';
836
+ confidence: number;
837
+ verified: boolean;
838
+ reasons: string[];
839
+ objective?: string;
840
+ };
841
+ type ExecutionDryRunResult = {
842
+ feasible: boolean;
843
+ reasons: string[];
844
+ };
845
+ type ExecutionApplyResult = {
846
+ applied: boolean;
847
+ evidence?: string;
848
+ reason?: string;
849
+ };
850
+ type ExecutionValidateResult = {
851
+ passed: boolean;
852
+ metrics?: Record<string, number | string | boolean>;
853
+ reason?: string;
854
+ };
855
+ type ExecutionRollbackResult = {
856
+ rolledBack: boolean;
857
+ reason?: string;
858
+ };
859
+ interface ExecutionAdapter {
860
+ dryRun: (input: {
861
+ record: ExecutionDecisionRecord;
862
+ }) => Promise<ExecutionDryRunResult> | ExecutionDryRunResult;
863
+ apply: (input: {
864
+ record: ExecutionDecisionRecord;
865
+ }) => Promise<ExecutionApplyResult> | ExecutionApplyResult;
866
+ validate: (input: {
867
+ record: ExecutionDecisionRecord;
868
+ apply: ExecutionApplyResult;
869
+ }) => Promise<ExecutionValidateResult> | ExecutionValidateResult;
870
+ rollback?: (input: {
871
+ record: ExecutionDecisionRecord;
872
+ apply: ExecutionApplyResult;
873
+ validate: ExecutionValidateResult;
874
+ }) => Promise<ExecutionRollbackResult> | ExecutionRollbackResult;
875
+ }
876
+ type ExecutionRunResult = {
877
+ mode: ExecutionRolloutMode;
878
+ attempted: boolean;
879
+ applied: boolean;
880
+ validated: boolean;
881
+ rolledBack: boolean;
882
+ reason: string;
883
+ dryRun?: ExecutionDryRunResult;
884
+ apply?: ExecutionApplyResult;
885
+ validate?: ExecutionValidateResult;
886
+ rollback?: ExecutionRollbackResult;
887
+ };
888
+ declare const buildDecisionRecord: (input: {
889
+ decision: "hold" | "observe" | "adapt";
890
+ confidence: number;
891
+ verified: boolean;
892
+ reasons: string[];
893
+ objective?: string;
894
+ nowMs?: number;
895
+ }) => ExecutionDecisionRecord;
896
+ declare const runExecutionAdapter: (input: {
897
+ mode: ExecutionRolloutMode;
898
+ record: ExecutionDecisionRecord;
899
+ adapter?: ExecutionAdapter;
900
+ }) => Promise<ExecutionRunResult>;
901
+
831
902
  type AdaptiveTheme = 'bug' | 'reliability' | 'ux' | 'pricing' | 'feature' | 'praise' | 'noise';
832
903
  type AdaptiveFeedbackAggregate = {
833
904
  generatedAt: string;
@@ -877,6 +948,23 @@ type AdaptiveAdaptationPlan = {
877
948
  rollbackCriteria: string;
878
949
  urgency?: 'normal' | 'immediate';
879
950
  };
951
+ type AdaptiveVerification = {
952
+ passed: boolean;
953
+ checks: {
954
+ hasPlan: boolean;
955
+ confidenceOk: boolean;
956
+ notNoiseTheme: boolean;
957
+ policyAllowsAdapt: boolean;
958
+ urgencyAllowed: boolean;
959
+ };
960
+ reasons: string[];
961
+ };
962
+ type AdaptiveExecution = {
963
+ attempted: boolean;
964
+ applied: boolean;
965
+ mode: 'observe' | 'apply';
966
+ reason: string;
967
+ };
880
968
  type AdaptiveReflectionStore = ReflectionStore & {
881
969
  loadPolicyState?: () => Promise<AdaptivePolicyState | null> | AdaptivePolicyState | null;
882
970
  savePolicyState?: (s: AdaptivePolicyState) => Promise<void> | void;
@@ -889,6 +977,12 @@ type RunAdaptiveReflectionOptions = {
889
977
  reflectionStore?: AdaptiveReflectionStore;
890
978
  reflectionOptions?: Omit<ReflectionCycleOptions, 'client' | 'listingId' | 'wallet' | 'signMessage' | 'store'>;
891
979
  policy?: AdaptivePolicyConfig;
980
+ execution?: {
981
+ mode?: 'observe' | 'apply';
982
+ rolloutMode?: ExecutionRolloutMode;
983
+ allowImmediateOnly?: boolean;
984
+ adapter?: ExecutionAdapter;
985
+ };
892
986
  now?: () => number;
893
987
  };
894
988
  declare const aggregateFeedbackSignals: (reviews: ListingReviewRecord[], options?: {
@@ -897,10 +991,47 @@ declare const aggregateFeedbackSignals: (reviews: ListingReviewRecord[], options
897
991
  }) => AdaptiveFeedbackAggregate;
898
992
  declare const evaluateAdaptiveReflectionPolicy: (aggregate: AdaptiveFeedbackAggregate, state: AdaptivePolicyState, policy?: AdaptivePolicyConfig, nowMs?: number) => AdaptivePolicyDecision;
899
993
  declare const buildAdaptivePlan: (decision: AdaptivePolicyDecision) => AdaptiveAdaptationPlan | null;
994
+ declare const verifyAdaptiveExecutionReadiness: (input: {
995
+ decision: AdaptivePolicyDecision;
996
+ plan: AdaptiveAdaptationPlan | null;
997
+ }, options?: {
998
+ minConfidence?: number;
999
+ allowImmediateOnly?: boolean;
1000
+ }) => AdaptiveVerification;
900
1001
  declare const runAdaptiveReflectionCycle: (opts: RunAdaptiveReflectionOptions) => Promise<{
901
1002
  generatedAt: string;
902
1003
  aggregate: AdaptiveFeedbackAggregate;
903
1004
  decision: AdaptivePolicyDecision;
1005
+ verification: AdaptiveVerification;
1006
+ execution: AdaptiveExecution;
1007
+ plan: AdaptiveAdaptationPlan;
1008
+ reflection: ReflectionCycleResult;
1009
+ policyState: AdaptivePolicyState;
1010
+ }>;
1011
+
1012
+ type AgentReviewRuntimeOptions = {
1013
+ client: ReflectionClient;
1014
+ listingId: string;
1015
+ wallet: string;
1016
+ signMessage: ReflectionCycleOptions['signMessage'];
1017
+ reflectionStore?: AdaptiveReflectionStore;
1018
+ policy?: AdaptivePolicyConfig;
1019
+ rolloutMode?: ExecutionRolloutMode;
1020
+ adapter: ExecutionAdapter;
1021
+ allowImmediateOnly?: boolean;
1022
+ reflectionOptions?: Omit<ReflectionCycleOptions, 'client' | 'listingId' | 'wallet' | 'signMessage' | 'store'>;
1023
+ now?: () => number;
1024
+ };
1025
+ /**
1026
+ * Required default review runtime for VIBEIAO agents.
1027
+ * Enforces verify->execute using the execution adapter contract.
1028
+ */
1029
+ declare const runAgentReviewRuntimeCycle: (opts: AgentReviewRuntimeOptions) => Promise<{
1030
+ generatedAt: string;
1031
+ aggregate: AdaptiveFeedbackAggregate;
1032
+ decision: AdaptivePolicyDecision;
1033
+ verification: AdaptiveVerification;
1034
+ execution: AdaptiveExecution;
904
1035
  plan: AdaptiveAdaptationPlan;
905
1036
  reflection: ReflectionCycleResult;
906
1037
  policyState: AdaptivePolicyState;
@@ -1184,7 +1315,7 @@ declare class ReviewGate {
1184
1315
  assertClear(listingId: string, wallet: string): void;
1185
1316
  }
1186
1317
 
1187
- declare const compareVersions: (currentVersion: string, latestVersion: string) => 1 | 0 | -1;
1318
+ declare const compareVersions: (currentVersion: string, latestVersion: string) => 0 | 1 | -1;
1188
1319
  declare const buildSdkUpdateCommand: (packageName?: string) => string;
1189
1320
  declare const checkForSdkUpdate: (options?: SdkUpdateCheckOptions) => Promise<SdkUpdateStatus>;
1190
1321
  declare const checkForSdkUpdatePolicy: (options: SdkUpdatePolicyCheckOptions) => Promise<SdkUpdateStatus>;
@@ -1365,4 +1496,4 @@ declare const getResourceSnapshot: (options: {
1365
1496
  apiBase?: string;
1366
1497
  }) => Promise<ResourceSnapshot>;
1367
1498
 
1368
- export { type SdkUpdateCheckOptions as $, type AdaptiveAdaptationPlan as A, type BuybackEvent as B, CONTEXT_PACK_SECTION_ORDER as C, type DurabilityCheckpointWriteOptions as D, type ListingNamingValidationOptions as E, type ListingNamingValidationResult as F, type ListingQuery as G, type ListingReviewCreatePayload as H, type ListingReviewResponsePayload as I, type ListingVersionPayload as J, type MarketingLinkOptions as K, LISTING_NAME_MAX_LENGTH as L, type MarketingCampaign as M, type MemoryPingChallengeResponse as N, type MemoryPingPayload as O, type OpenRouterCredits as P, type ProcurementCandidate as Q, type ProcurementDecision as R, type ProcurementTaskProfile as S, type ProcurementWeights as T, type TopupDecision, type TopupRequest, type TreasuryLedgerEvent, type TreasuryPolicy, type TreasuryPolicyV1, type TreasuryState, type ResourceProviderManifestEntry as U, type ResourceSnapshot as V, ReviewGate as W, type ReviewGateRecord as X, type ReviewRequiredPayload as Y, type RunAdaptiveReflectionOptions as Z, SdkAutoUpdatedRestartRequiredError as _, type AdaptiveFeedbackAggregate as a, type SdkUpdatePolicyCheckOptions as a0, SdkUpdateRequiredError as a1, type SdkUpdateStatus as a2, VIBEIAO_IDL as a3, VibeClient as a4, type VibeClientOptions as a5, VibeRegistry as a6, aggregateFeedbackSignals as a7, assertSurvivalProvidersConfigured as a8, buildAdaptivePlan as a9, evaluateAdaptiveReflectionPolicy as aA, getResourceSnapshot as aB, normalizeListingText as aC, rankListingsForTask as aD, runAdaptiveReflectionCycle as aE, sanitizeListingNaming as aF, scoreListingForTask as aG, validateContextPack as aH, validateListingNaming as aI, buildBadgeMarkdown as aa, buildClaimMessage as ab, buildJupiterSwapUrl as ac, buildListingVersionMessage as ad, buildMemoryPingMessage as ae, buildOwnerTransferMessage as af, buildProcurementPrompt as ag, buildRaydiumSwapUrl as ah, buildReviewPrompt as ai, buildReviewRequired as aj, buildReviewResponseMessage as ak, buildSdkUpdateCommand as al, buildShareCopy as am, buildShareLink as an, buildTradeLinks as ao, checkForSdkUpdate as ap, checkForSdkUpdatePolicy as aq, compareVersions as ar, createApiCreditProvider as as, createApiCreditProviders as at, createApiCreditProvidersFromManifest as au, createCampaign as av, createContextPack as aw, createDurabilityProxyClient as ax, decideProcurementForTask as ay, estimateContextPackTokens as az, type AdaptivePolicyConfig as b, buildTreasuryLedgerEvent, type AdaptivePolicyDecision as c, createTreasuryPolicy, type AdaptivePolicyState as d, type AdaptiveReflectionStore as e, evaluateTopupRequest, type AdaptiveTheme as f, type AgentResourceProvidersManifest as g, type AnalyticsPoint as h, type ApiCreditProvider as i, type ApiCreditProviderFactoryOptions as j, type ApiCreditProviderPreset as k, type ApiCreditProviderPresetInput as l, type ApiResponse as m, type ContextPack as n, type ContextPackBudget as o, type ContextPackInput as p, type ContextPackOptions as q, type ContextPackSectionKey as r, type ContextPackSections as s, type DurabilityProxyClientOptions as t, treasuryStateFromSnapshot, type DurabilityRestoreDrillWriteOptions as u, LISTING_NAME_RECOMMENDED_MAX as v, validateTreasuryPolicy, LISTING_TAGLINE_MAX_LENGTH as w, LISTING_TAGLINE_RECOMMENDED_MAX as x, type LeaderboardEntry as y, type LeaderboardQuery as z };
1499
+ export { type ProcurementCandidate as $, type AdaptiveAdaptationPlan as A, type BuybackEvent as B, CONTEXT_PACK_SECTION_ORDER as C, type DurabilityCheckpointWriteOptions as D, type ExecutionAdapter as E, type ExecutionDryRunResult as F, type ExecutionRollbackResult as G, type ExecutionRolloutMode as H, type ExecutionRunResult as I, type ExecutionValidateResult as J, LISTING_NAME_RECOMMENDED_MAX as K, LISTING_NAME_MAX_LENGTH as L, LISTING_TAGLINE_MAX_LENGTH as M, LISTING_TAGLINE_RECOMMENDED_MAX as N, type LeaderboardEntry as O, type LeaderboardQuery as P, type ListingNamingValidationOptions as Q, type ListingNamingValidationResult as R, type ListingQuery as S, type ListingReviewCreatePayload as T, type TopupDecision, type TopupRequest, type TreasuryLedgerEvent, type TreasuryPolicy, type TreasuryPolicyV1, type TreasuryState, type ListingReviewResponsePayload as U, type ListingVersionPayload as V, type MarketingCampaign as W, type MarketingLinkOptions as X, type MemoryPingChallengeResponse as Y, type MemoryPingPayload as Z, type OpenRouterCredits as _, type AdaptiveExecution as a, type ProcurementDecision as a0, type ProcurementTaskProfile as a1, type ProcurementWeights as a2, type ResourceProviderManifestEntry as a3, type ResourceSnapshot as a4, ReviewGate as a5, type ReviewGateRecord as a6, type ReviewRequiredPayload as a7, type RunAdaptiveReflectionOptions as a8, SdkAutoUpdatedRestartRequiredError as a9, buildTradeLinks as aA, checkForSdkUpdate as aB, checkForSdkUpdatePolicy as aC, compareVersions as aD, createApiCreditProvider as aE, createApiCreditProviders as aF, createApiCreditProvidersFromManifest as aG, createCampaign as aH, createContextPack as aI, createDurabilityProxyClient as aJ, decideProcurementForTask as aK, estimateContextPackTokens as aL, evaluateAdaptiveReflectionPolicy as aM, getResourceSnapshot as aN, normalizeListingText as aO, rankListingsForTask as aP, runAdaptiveReflectionCycle as aQ, runAgentReviewRuntimeCycle as aR, runExecutionAdapter as aS, sanitizeListingNaming as aT, scoreListingForTask as aU, validateContextPack as aV, validateListingNaming as aW, verifyAdaptiveExecutionReadiness as aX, type SdkUpdateCheckOptions as aa, type SdkUpdatePolicyCheckOptions as ab, SdkUpdateRequiredError as ac, type SdkUpdateStatus as ad, VIBEIAO_IDL as ae, VibeClient as af, type VibeClientOptions as ag, VibeRegistry as ah, aggregateFeedbackSignals as ai, assertSurvivalProvidersConfigured as aj, buildAdaptivePlan as ak, buildBadgeMarkdown as al, buildClaimMessage as am, buildDecisionRecord as an, buildJupiterSwapUrl as ao, buildListingVersionMessage as ap, buildMemoryPingMessage as aq, buildOwnerTransferMessage as ar, buildProcurementPrompt as as, buildRaydiumSwapUrl as at, buildReviewPrompt as au, buildReviewRequired as av, buildReviewResponseMessage as aw, buildSdkUpdateCommand as ax, buildShareCopy as ay, buildShareLink as az, type AdaptiveFeedbackAggregate as b, buildTreasuryLedgerEvent, type AdaptivePolicyConfig as c, createTreasuryPolicy, type AdaptivePolicyDecision as d, type AdaptivePolicyState as e, evaluateTopupRequest, type AdaptiveReflectionStore as f, type AdaptiveTheme as g, type AdaptiveVerification as h, type AgentResourceProvidersManifest as i, type AgentReviewRuntimeOptions as j, type AnalyticsPoint as k, type ApiCreditProvider as l, type ApiCreditProviderFactoryOptions as m, type ApiCreditProviderPreset as n, type ApiCreditProviderPresetInput as o, type ApiResponse as p, type ContextPack as q, type ContextPackBudget as r, type ContextPackInput as s, type ContextPackOptions as t, treasuryStateFromSnapshot, type ContextPackSectionKey as u, type ContextPackSections as v, validateTreasuryPolicy, type DurabilityProxyClientOptions as w, type DurabilityRestoreDrillWriteOptions as x, type ExecutionApplyResult as y, type ExecutionDecisionRecord as z };
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.45",
5
+ "version": "0.1.47",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "exports": {