@vibeiao/sdk 0.1.31 → 0.1.33
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 +123 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +542 -10
- package/dist/treasuryGuardian.d.ts +166 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -383,6 +383,129 @@ Routing policy after acceptance:
|
|
|
383
383
|
- Primary: treasury-proxy route
|
|
384
384
|
- Fallback: original provider API key only when primary route fails or is policy-blocked
|
|
385
385
|
|
|
386
|
+
## Human App Reflective Loop Pack (First-class)
|
|
387
|
+
|
|
388
|
+
Use the built-in pack for human app lifecycle runs:
|
|
389
|
+
|
|
390
|
+
- phases: `research -> hypothesis -> build -> launch -> observe -> reflect -> iterate`
|
|
391
|
+
- explicit per-phase inputs/outputs + go/no-go + KPI + rollback conditions
|
|
392
|
+
- optional tool-choice policy with required rationale logging
|
|
393
|
+
- trial evaluation rubric (research depth / iteration quality / outcome usefulness)
|
|
394
|
+
|
|
395
|
+
```ts
|
|
396
|
+
import {
|
|
397
|
+
createHumanAppLoopSpec,
|
|
398
|
+
scaffoldHumanAppLoopPack,
|
|
399
|
+
evaluateHumanAppTrial,
|
|
400
|
+
} from '@vibeiao/sdk';
|
|
401
|
+
|
|
402
|
+
const spec = createHumanAppLoopSpec();
|
|
403
|
+
|
|
404
|
+
await scaffoldHumanAppLoopPack({
|
|
405
|
+
root: process.cwd(),
|
|
406
|
+
outputDir: 'projects/vibeiao/human-app-loop-pack',
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
const trial = evaluateHumanAppTrial({
|
|
410
|
+
id: 'trial-1',
|
|
411
|
+
evidence: {
|
|
412
|
+
researchNotesCount: 4,
|
|
413
|
+
hypothesisCount: 2,
|
|
414
|
+
experimentsRun: 1,
|
|
415
|
+
measurableKpiCount: 2,
|
|
416
|
+
rollbackPlanPresent: true,
|
|
417
|
+
shippedArtifactPresent: true,
|
|
418
|
+
iterationSteps: 1,
|
|
419
|
+
},
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
console.log(spec.schema, trial.pass, trial.weightedScore);
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
## Outcome-Bound Autonomous Flow (Hard Completion Gate)
|
|
426
|
+
|
|
427
|
+
Use this when the task must not be considered done until it is truly live.
|
|
428
|
+
|
|
429
|
+
Required completion gates:
|
|
430
|
+
- public deploy URL exists
|
|
431
|
+
- listing metadata is updated
|
|
432
|
+
- external smoke check passes
|
|
433
|
+
- evidence log path recorded
|
|
434
|
+
- context-pack preflight passed
|
|
435
|
+
|
|
436
|
+
```ts
|
|
437
|
+
import {
|
|
438
|
+
evaluateOutcomeBoundRun,
|
|
439
|
+
assertOutcomeBoundCompleted,
|
|
440
|
+
} from '@vibeiao/sdk';
|
|
441
|
+
|
|
442
|
+
const status = evaluateOutcomeBoundRun({
|
|
443
|
+
runId: 'release-2026-02-18',
|
|
444
|
+
objective: 'Ship human app v1 live',
|
|
445
|
+
publicDeployUrl: 'https://example.com/app',
|
|
446
|
+
listingId: '<listing-id>',
|
|
447
|
+
listingUpdated: true,
|
|
448
|
+
externalSmokeCheck: { passed: true, checker: 'curl -I' },
|
|
449
|
+
evidenceLogPath: 'generated/evals/release/run.md',
|
|
450
|
+
contextPackPreflight: { passed: true, scope: 'release' },
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
// Throws if any hard gate is missing.
|
|
454
|
+
assertOutcomeBoundCompleted({
|
|
455
|
+
runId: 'release-2026-02-18',
|
|
456
|
+
objective: 'Ship human app v1 live',
|
|
457
|
+
publicDeployUrl: 'https://example.com/app',
|
|
458
|
+
listingId: '<listing-id>',
|
|
459
|
+
listingUpdated: true,
|
|
460
|
+
externalSmokeCheck: { passed: true },
|
|
461
|
+
evidenceLogPath: 'generated/evals/release/run.md',
|
|
462
|
+
contextPackPreflight: { passed: true, scope: 'release' },
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
console.log(status.completed, status.failedGates);
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
## Strict Memory Runtime Preset (Safe Upgrade Path)
|
|
469
|
+
|
|
470
|
+
Use this preset when you want SDK-level parity for strict memory discipline across agents.
|
|
471
|
+
|
|
472
|
+
What it enforces (for complex/mutating tasks):
|
|
473
|
+
- context-pack prepared
|
|
474
|
+
- semantic recall confirmed
|
|
475
|
+
- mutation approval preflight passed
|
|
476
|
+
|
|
477
|
+
And it supports safe rollout modes:
|
|
478
|
+
- `observe` (default): collect/validate behavior
|
|
479
|
+
- `enforce`: hard block when required gates are missing
|
|
480
|
+
|
|
481
|
+
```ts
|
|
482
|
+
import {
|
|
483
|
+
createStrictMemoryRuntimePreset,
|
|
484
|
+
evaluateStrictMemoryExecution,
|
|
485
|
+
upgradeToStrictMemoryRuntimePreset,
|
|
486
|
+
} from '@vibeiao/sdk';
|
|
487
|
+
|
|
488
|
+
const preset = createStrictMemoryRuntimePreset();
|
|
489
|
+
|
|
490
|
+
const evalResult = evaluateStrictMemoryExecution({
|
|
491
|
+
taskText: 'Deploy production release with listing migration and config writes',
|
|
492
|
+
isMutation: true,
|
|
493
|
+
contextPackPrepared: true,
|
|
494
|
+
semanticRecallConfirmed: true,
|
|
495
|
+
approvalPreflightPassed: true,
|
|
496
|
+
}, preset);
|
|
497
|
+
|
|
498
|
+
const upgrade = upgradeToStrictMemoryRuntimePreset({
|
|
499
|
+
current: preset,
|
|
500
|
+
targetMode: 'enforce',
|
|
501
|
+
backupCreated: true,
|
|
502
|
+
healthcheckPassed: true,
|
|
503
|
+
recentBlockRate: 0.1,
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
console.log(evalResult.allowed, upgrade.safe, upgrade.next.upgradePolicy.mode);
|
|
507
|
+
```
|
|
508
|
+
|
|
386
509
|
## Compounding Memory Standard (Recommended Default)
|
|
387
510
|
|
|
388
511
|
The SDK now includes a standardized layered memory scaffold modeled on long-running agent operation:
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ 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 AgentResourceProvidersManifest, a as AnalyticsPoint, b as ApiCreditProvider, c as ApiCreditProviderFactoryOptions, d as ApiCreditProviderPreset, e as ApiCreditProviderPresetInput, f as ApiResponse, B as BuybackEvent, C as CONTEXT_PACK_SECTION_ORDER, g as ContextPack, h as ContextPackBudget, i as ContextPackInput, j as ContextPackOptions, k as ContextPackSectionKey, l as ContextPackSections, D as DurabilityCheckpointWriteOptions, m as DurabilityProxyClientOptions, n as DurabilityRestoreDrillWriteOptions, L as LISTING_NAME_MAX_LENGTH,
|
|
9
|
+
export { A as AgentResourceProvidersManifest, a as AnalyticsPoint, b as ApiCreditProvider, c as ApiCreditProviderFactoryOptions, d as ApiCreditProviderPreset, e as ApiCreditProviderPresetInput, f as ApiResponse, B as BuybackEvent, C as CONTEXT_PACK_SECTION_ORDER, g as ContextPack, h as ContextPackBudget, i as ContextPackInput, j as ContextPackOptions, k as ContextPackSectionKey, l as ContextPackSections, D as DurabilityCheckpointWriteOptions, m as DurabilityProxyClientOptions, n as DurabilityRestoreDrillWriteOptions, H as HUMAN_APP_LOOP_PHASES, o as HUMAN_APP_LOOP_SCHEMA, p as HumanAppLoopPhase, q as HumanAppLoopSpec, r as HumanAppPhaseContract, s as HumanAppTrialEvaluation, t as HumanAppTrialInput, L 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 LeaderboardEntry, y as LeaderboardQuery, z as ListingNamingValidationOptions, E as ListingNamingValidationResult, F as ListingQuery, G as ListingReviewCreatePayload, I as ListingReviewResponsePayload, J as ListingVersionPayload, M as MarketingCampaign, K as MarketingLinkOptions, N as MemoryPingChallengeResponse, O as MemoryPingPayload, P as OUTCOME_BOUND_FLOW_SCHEMA, Q as OUTCOME_BOUND_REQUIRED_GATES, R as OpenRouterCredits, S as OutcomeBoundRequiredGate, T as OutcomeBoundRunInput, U as OutcomeBoundRunStatus, V as ProcurementCandidate, W as ProcurementDecision, X as ProcurementTaskProfile, Y as ProcurementWeights, Z as ResourceProviderManifestEntry, _ as ResourceSnapshot, $ as ReviewGate, a0 as ReviewGateRecord, a1 as ReviewRequiredPayload, a2 as STRICT_MEMORY_RUNTIME_SCHEMA, a3 as ScaffoldHumanAppLoopPackOptions, a4 as ScaffoldHumanAppLoopPackResult, a5 as SdkAutoUpdatedRestartRequiredError, a6 as SdkUpdateCheckOptions, a7 as SdkUpdatePolicyCheckOptions, a8 as SdkUpdateRequiredError, a9 as SdkUpdateStatus, aa as StrictMemoryEvaluation, ab as StrictMemoryEvaluationInput, ac as StrictMemoryRuntimePreset, ad as StrictMemoryTriggerSet, ae as StrictMemoryUpgradeInput, af as StrictMemoryUpgradePolicy, ag as StrictMemoryUpgradeResult, TopupDecision, TopupRequest, TreasuryLedgerEvent, TreasuryPolicy, TreasuryPolicyV1, TreasuryState, ah as VIBEIAO_IDL, ai as VibeClient, aj as VibeClientOptions, ak as VibeRegistry, al as assertOutcomeBoundCompleted, am as assertSurvivalProvidersConfigured, an as buildBadgeMarkdown, ao as buildClaimMessage, ap as buildJupiterSwapUrl, aq as buildListingVersionMessage, ar as buildMemoryPingMessage, as as buildOwnerTransferMessage, at as buildProcurementPrompt, au as buildRaydiumSwapUrl, av as buildReviewPrompt, aw as buildReviewRequired, ax as buildReviewResponseMessage, ay as buildSdkUpdateCommand, az as buildShareCopy, aA as buildShareLink, aB as buildTradeLinks, buildTreasuryLedgerEvent, aC as checkForSdkUpdate, aD as checkForSdkUpdatePolicy, aE as compareVersions, aF as createApiCreditProvider, aG as createApiCreditProviders, aH as createApiCreditProvidersFromManifest, aI as createCampaign, aJ as createContextPack, aK as createDurabilityProxyClient, aL as createHumanAppLoopSpec, aM as createStrictMemoryRuntimePreset, createTreasuryPolicy, aN as decideProcurementForTask, aO as estimateContextPackTokens, aP as evaluateHumanAppTrial, aQ as evaluateOutcomeBoundRun, aR as evaluateStrictMemoryExecution, evaluateTopupRequest, aS as getResourceSnapshot, aT as isComplexTask, aU as normalizeListingText, aV as rankListingsForTask, aW as sanitizeListingNaming, aX as scaffoldHumanAppLoopPack, aY as scoreListingForTask, treasuryStateFromSnapshot, aZ as upgradeToStrictMemoryRuntimePreset, a_ as validateContextPack, a$ as validateListingNaming, validateTreasuryPolicy } from './treasuryGuardian.js';
|
|
10
10
|
export { fetchSolBalance, fetchTokenBalance, fetchTokenBalances } from './solana.js';
|
|
11
11
|
import '@coral-xyz/anchor';
|
package/dist/index.js
CHANGED
|
@@ -233,6 +233,524 @@ var validateContextPack = (value) => {
|
|
|
233
233
|
var CONTEXT_PACK_SECTION_ORDER = [...SECTION_ORDER];
|
|
234
234
|
var estimateContextPackTokens = (textOrChars) => estimateTokensFromChars(typeof textOrChars === "number" ? textOrChars : textOrChars.length);
|
|
235
235
|
|
|
236
|
+
// src/humanAppLoop.ts
|
|
237
|
+
import { promises as fs } from "fs";
|
|
238
|
+
import path from "path";
|
|
239
|
+
var HUMAN_APP_LOOP_SCHEMA = "human-app-reflective-loop/v1";
|
|
240
|
+
var HUMAN_APP_LOOP_PHASES = [
|
|
241
|
+
"research",
|
|
242
|
+
"hypothesis",
|
|
243
|
+
"build",
|
|
244
|
+
"launch",
|
|
245
|
+
"observe",
|
|
246
|
+
"reflect",
|
|
247
|
+
"iterate"
|
|
248
|
+
];
|
|
249
|
+
var nowIso = () => (/* @__PURE__ */ new Date()).toISOString();
|
|
250
|
+
var createHumanAppLoopSpec = (createdAt = nowIso()) => ({
|
|
251
|
+
schema: HUMAN_APP_LOOP_SCHEMA,
|
|
252
|
+
createdAt,
|
|
253
|
+
phases: [
|
|
254
|
+
{
|
|
255
|
+
phase: "research",
|
|
256
|
+
requiredInputs: ["problem statement", "target users", "constraints (time/budget/risk)"],
|
|
257
|
+
requiredOutputs: ["evidence log", "competitor/alternative scan", "top unresolved assumptions"],
|
|
258
|
+
goNoGoCriteria: [">=3 independent evidence points", "clear user pain identified"],
|
|
259
|
+
stopOrRollbackConditions: ["no meaningful user pain found", "constraints make task infeasible"],
|
|
260
|
+
kpis: ["evidence_count", "source_diversity", "problem_clarity_score"]
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
phase: "hypothesis",
|
|
264
|
+
requiredInputs: ["research outputs"],
|
|
265
|
+
requiredOutputs: ["testable hypotheses", "success/failure thresholds", "experiment plan"],
|
|
266
|
+
goNoGoCriteria: ["each hypothesis is falsifiable", "each has measurable KPI target"],
|
|
267
|
+
stopOrRollbackConditions: ["hypothesis not measurable", "missing baseline"],
|
|
268
|
+
kpis: ["hypothesis_count", "kpi_defined_ratio"]
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
phase: "build",
|
|
272
|
+
requiredInputs: ["approved hypothesis", "scope boundary"],
|
|
273
|
+
requiredOutputs: ["MVP artifact", "change log", "known limitations list"],
|
|
274
|
+
goNoGoCriteria: ["MVP covers core user path", "critical defects resolved"],
|
|
275
|
+
stopOrRollbackConditions: ["critical bug unresolved", "scope creep beyond budget"],
|
|
276
|
+
kpis: ["mvp_completion", "critical_bug_count", "time_to_mvp_hours"]
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
phase: "launch",
|
|
280
|
+
requiredInputs: ["MVP artifact", "release checklist"],
|
|
281
|
+
requiredOutputs: ["launch record", "segment/channel", "baseline metrics snapshot"],
|
|
282
|
+
goNoGoCriteria: ["launch checklist passed", "monitoring ready"],
|
|
283
|
+
stopOrRollbackConditions: ["monitoring absent", "compliance/safety issue found"],
|
|
284
|
+
kpis: ["launch_readiness_score", "time_to_first_user_feedback_hours"]
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
phase: "observe",
|
|
288
|
+
requiredInputs: ["launch metrics", "feedback stream"],
|
|
289
|
+
requiredOutputs: ["observation report", "anomaly list", "KPI trend summary"],
|
|
290
|
+
goNoGoCriteria: ["minimum observation window met", "KPI deltas measurable"],
|
|
291
|
+
stopOrRollbackConditions: ["harmful regressions", "rollback threshold crossed"],
|
|
292
|
+
kpis: ["retention_d1", "task_success_rate", "error_rate", "feedback_signal_ratio"]
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
phase: "reflect",
|
|
296
|
+
requiredInputs: ["observation report", "hypothesis outcomes"],
|
|
297
|
+
requiredOutputs: ["lessons learned", "root-cause analysis", "decision log"],
|
|
298
|
+
goNoGoCriteria: ["at least one actionable insight", "root cause linked to evidence"],
|
|
299
|
+
stopOrRollbackConditions: ["insufficient evidence quality"],
|
|
300
|
+
kpis: ["insight_actionability_score", "decision_traceability_ratio"]
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
phase: "iterate",
|
|
304
|
+
requiredInputs: ["reflection decisions", "prioritized backlog"],
|
|
305
|
+
requiredOutputs: ["next-cycle plan", "versioned experiment backlog", "risk updates"],
|
|
306
|
+
goNoGoCriteria: ["next cycle has explicit KPI targets", "owner and timeline assigned"],
|
|
307
|
+
stopOrRollbackConditions: ["no measurable improvement path"],
|
|
308
|
+
kpis: ["iteration_cycle_time", "kpi_improvement_rate", "rollback_incident_count"]
|
|
309
|
+
}
|
|
310
|
+
],
|
|
311
|
+
optionalToolUsePolicy: {
|
|
312
|
+
enabled: true,
|
|
313
|
+
rules: [
|
|
314
|
+
"Tool choice is optional, but each phase must record a one-line rationale for selected tools.",
|
|
315
|
+
"Prefer the least-privilege/lowest-cost tool that can satisfy evidence quality.",
|
|
316
|
+
"If external tools are skipped, document why manual reasoning is sufficient."
|
|
317
|
+
]
|
|
318
|
+
},
|
|
319
|
+
overlapWithAgentListingLoops: {
|
|
320
|
+
overlap: [
|
|
321
|
+
"Both loops require measurable KPI targets and decision gates.",
|
|
322
|
+
"Both run observe -> reflect -> iterate compounding cycles.",
|
|
323
|
+
"Both benefit from versioned changelogs and user/review feedback integration."
|
|
324
|
+
],
|
|
325
|
+
differences: [
|
|
326
|
+
"Human app loop starts with product problem discovery; agent-listing loops start with listing/distribution economics.",
|
|
327
|
+
"Human app loop emphasizes user value and usability outcomes; agent-listing loops emphasize market visibility, conversion, and listing operations.",
|
|
328
|
+
"Human app loop gates include stop/rollback on product harm/usability regressions before growth mechanics."
|
|
329
|
+
]
|
|
330
|
+
},
|
|
331
|
+
evaluationRubric: {
|
|
332
|
+
dimensions: [
|
|
333
|
+
{
|
|
334
|
+
id: "researchDepth",
|
|
335
|
+
description: "Evidence quality, source diversity, and assumption clarity.",
|
|
336
|
+
weight: 0.35,
|
|
337
|
+
passThreshold: 3
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
id: "iterationQuality",
|
|
341
|
+
description: "Strength of hypothesis-to-build-to-reflect loop with measurable changes.",
|
|
342
|
+
weight: 0.35,
|
|
343
|
+
passThreshold: 3
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
id: "outcomeUsefulness",
|
|
347
|
+
description: "Practical utility of outputs for a human owner/builder.",
|
|
348
|
+
weight: 0.3,
|
|
349
|
+
passThreshold: 3
|
|
350
|
+
}
|
|
351
|
+
],
|
|
352
|
+
overallPassThreshold: 3.2
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
var clamp = (v, min, max) => Math.max(min, Math.min(max, v));
|
|
356
|
+
var evaluateHumanAppTrial = (trial, spec = createHumanAppLoopSpec("1970-01-01T00:00:00.000Z")) => {
|
|
357
|
+
const notes = [];
|
|
358
|
+
const r = trial.evidence;
|
|
359
|
+
const researchDepth = clamp(
|
|
360
|
+
(r.researchNotesCount >= 4 ? 2 : r.researchNotesCount >= 2 ? 1 : 0) + (r.hypothesisCount >= 2 ? 1 : 0) + (r.measurableKpiCount >= 2 ? 1 : 0),
|
|
361
|
+
1,
|
|
362
|
+
5
|
|
363
|
+
);
|
|
364
|
+
const iterationQuality = clamp(
|
|
365
|
+
(r.experimentsRun >= 2 ? 2 : r.experimentsRun >= 1 ? 1 : 0) + (r.iterationSteps >= 2 ? 2 : r.iterationSteps >= 1 ? 1 : 0) + (r.rollbackPlanPresent ? 1 : 0),
|
|
366
|
+
1,
|
|
367
|
+
5
|
|
368
|
+
);
|
|
369
|
+
const outcomeUsefulness = clamp(
|
|
370
|
+
(r.shippedArtifactPresent ? 2 : 0) + (r.measurableKpiCount >= 2 ? 2 : r.measurableKpiCount >= 1 ? 1 : 0) + (r.rollbackPlanPresent ? 1 : 0),
|
|
371
|
+
1,
|
|
372
|
+
5
|
|
373
|
+
);
|
|
374
|
+
const weights = Object.fromEntries(spec.evaluationRubric.dimensions.map((d) => [d.id, d.weight]));
|
|
375
|
+
const weightedScore = researchDepth * (weights.researchDepth || 0) + iterationQuality * (weights.iterationQuality || 0) + outcomeUsefulness * (weights.outcomeUsefulness || 0);
|
|
376
|
+
if (!r.rollbackPlanPresent) notes.push("Missing rollback plan evidence.");
|
|
377
|
+
if (r.measurableKpiCount < 2) notes.push("Insufficient measurable KPI coverage.");
|
|
378
|
+
if (r.experimentsRun < 1) notes.push("No experiment run evidence.");
|
|
379
|
+
const dimensionThresholds = Object.fromEntries(
|
|
380
|
+
spec.evaluationRubric.dimensions.map((d) => [d.id, d.passThreshold])
|
|
381
|
+
);
|
|
382
|
+
const pass = researchDepth >= (dimensionThresholds.researchDepth || 0) && iterationQuality >= (dimensionThresholds.iterationQuality || 0) && outcomeUsefulness >= (dimensionThresholds.outcomeUsefulness || 0) && weightedScore >= spec.evaluationRubric.overallPassThreshold;
|
|
383
|
+
return {
|
|
384
|
+
id: trial.id,
|
|
385
|
+
scores: { researchDepth, iterationQuality, outcomeUsefulness },
|
|
386
|
+
weightedScore: Number(weightedScore.toFixed(2)),
|
|
387
|
+
pass,
|
|
388
|
+
notes
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
var ensureDir = async (dir) => {
|
|
392
|
+
await fs.mkdir(dir, { recursive: true });
|
|
393
|
+
};
|
|
394
|
+
var writeIfAllowed = async (filePath, content, overwrite) => {
|
|
395
|
+
if (!overwrite) {
|
|
396
|
+
try {
|
|
397
|
+
await fs.access(filePath);
|
|
398
|
+
return false;
|
|
399
|
+
} catch {
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
await fs.writeFile(filePath, content, "utf-8");
|
|
403
|
+
return true;
|
|
404
|
+
};
|
|
405
|
+
var buildLoopRunTemplate = () => `# Human App Reflective Loop Run Template
|
|
406
|
+
|
|
407
|
+
Use this in order: research -> hypothesis -> build -> launch -> observe -> reflect -> iterate
|
|
408
|
+
|
|
409
|
+
## 0) Metadata
|
|
410
|
+
- App idea:
|
|
411
|
+
- Target user:
|
|
412
|
+
- Owner:
|
|
413
|
+
- Date:
|
|
414
|
+
- Version/cycle:
|
|
415
|
+
|
|
416
|
+
## 1) Research
|
|
417
|
+
- Inputs used:
|
|
418
|
+
- Evidence notes (>=3):
|
|
419
|
+
- Output summary:
|
|
420
|
+
- Go/No-Go decision:
|
|
421
|
+
|
|
422
|
+
## 2) Hypothesis
|
|
423
|
+
- Hypothesis H1:
|
|
424
|
+
- KPI targets + baseline:
|
|
425
|
+
- Experiment plan:
|
|
426
|
+
- Go/No-Go decision:
|
|
427
|
+
|
|
428
|
+
## 3) Build
|
|
429
|
+
- Scope:
|
|
430
|
+
- Artifact shipped:
|
|
431
|
+
- Known limitations:
|
|
432
|
+
- Go/No-Go decision:
|
|
433
|
+
|
|
434
|
+
## 4) Launch
|
|
435
|
+
- Channel/audience:
|
|
436
|
+
- Launch checklist:
|
|
437
|
+
- Baseline metric snapshot:
|
|
438
|
+
- Go/No-Go decision:
|
|
439
|
+
|
|
440
|
+
## 5) Observe
|
|
441
|
+
- Observation window:
|
|
442
|
+
- KPI deltas:
|
|
443
|
+
- Risks/anomalies:
|
|
444
|
+
- Stop/Rollback triggered? why/why not:
|
|
445
|
+
|
|
446
|
+
## 6) Reflect
|
|
447
|
+
- What worked:
|
|
448
|
+
- What failed:
|
|
449
|
+
- Root cause evidence:
|
|
450
|
+
- Decisions recorded:
|
|
451
|
+
|
|
452
|
+
## 7) Iterate
|
|
453
|
+
- Next-cycle plan:
|
|
454
|
+
- Backlog prioritization:
|
|
455
|
+
- KPI delta target:
|
|
456
|
+
- Rollback guardrails:
|
|
457
|
+
`;
|
|
458
|
+
var buildSubagentTaskTemplate = () => `# Subagent Task Template \u2014 Human App Reflective Loop
|
|
459
|
+
|
|
460
|
+
You are tasked to run ONE full human-app reflective loop cycle on a small app/game idea.
|
|
461
|
+
|
|
462
|
+
Required order (do not skip):
|
|
463
|
+
1. research
|
|
464
|
+
2. hypothesis
|
|
465
|
+
3. build (MVP spec or mock implementation)
|
|
466
|
+
4. launch (simulated launch plan)
|
|
467
|
+
5. observe (expected metrics + monitoring)
|
|
468
|
+
6. reflect
|
|
469
|
+
7. iterate
|
|
470
|
+
|
|
471
|
+
Requirements:
|
|
472
|
+
- Include measurable KPIs and thresholds.
|
|
473
|
+
- Include explicit go/no-go decision at each phase.
|
|
474
|
+
- Include stop/rollback conditions.
|
|
475
|
+
- If you use tools, add one-line justification per tool.
|
|
476
|
+
- Output using LOOP_RUN_TEMPLATE.md headings.
|
|
477
|
+
`;
|
|
478
|
+
var buildScorecardTemplate = () => `# Human App Loop Trial Scorecard
|
|
479
|
+
|
|
480
|
+
## Trial ID
|
|
481
|
+
-
|
|
482
|
+
|
|
483
|
+
## Scores (1-5)
|
|
484
|
+
- researchDepth:
|
|
485
|
+
- iterationQuality:
|
|
486
|
+
- outcomeUsefulness:
|
|
487
|
+
- weightedScore:
|
|
488
|
+
- pass/fail:
|
|
489
|
+
|
|
490
|
+
## Evidence
|
|
491
|
+
- research notes count:
|
|
492
|
+
- hypotheses count:
|
|
493
|
+
- experiments run:
|
|
494
|
+
- measurable KPI count:
|
|
495
|
+
- rollback plan present:
|
|
496
|
+
- shipped artifact present:
|
|
497
|
+
- iteration steps:
|
|
498
|
+
|
|
499
|
+
## Issues / Fixes
|
|
500
|
+
-
|
|
501
|
+
`;
|
|
502
|
+
var buildReadme = () => `# Human App Reflective Loop Pack
|
|
503
|
+
|
|
504
|
+
This pack is first-class scaffold for human app lifecycle execution.
|
|
505
|
+
|
|
506
|
+
## Files
|
|
507
|
+
- LOOP_RUN_TEMPLATE.md
|
|
508
|
+
- SUBAGENT_TASK_TEMPLATE.md
|
|
509
|
+
- TRIAL_SCORECARD_TEMPLATE.md
|
|
510
|
+
- SPEC.snapshot.json
|
|
511
|
+
|
|
512
|
+
## Quick usage
|
|
513
|
+
1) Fill LOOP_RUN_TEMPLATE.md for a cycle.
|
|
514
|
+
2) For delegated runs, paste SUBAGENT_TASK_TEMPLATE.md into a subagent task.
|
|
515
|
+
3) Evaluate trial outputs with TRIAL_SCORECARD_TEMPLATE.md and the SDK evaluator.
|
|
516
|
+
`;
|
|
517
|
+
var scaffoldHumanAppLoopPack = async (options = {}) => {
|
|
518
|
+
const root = path.resolve(options.root || ".");
|
|
519
|
+
const outputDir = path.resolve(root, options.outputDir || "projects/vibeiao/human-app-loop-pack");
|
|
520
|
+
const overwrite = Boolean(options.overwrite);
|
|
521
|
+
const createdAt = nowIso();
|
|
522
|
+
const files = [];
|
|
523
|
+
await ensureDir(outputDir);
|
|
524
|
+
const spec = createHumanAppLoopSpec(createdAt);
|
|
525
|
+
const writes = [
|
|
526
|
+
["LOOP_RUN_TEMPLATE.md", buildLoopRunTemplate()],
|
|
527
|
+
["SUBAGENT_TASK_TEMPLATE.md", buildSubagentTaskTemplate()],
|
|
528
|
+
["TRIAL_SCORECARD_TEMPLATE.md", buildScorecardTemplate()],
|
|
529
|
+
["README.md", buildReadme()],
|
|
530
|
+
["SPEC.snapshot.json", `${JSON.stringify(spec, null, 2)}
|
|
531
|
+
`]
|
|
532
|
+
];
|
|
533
|
+
for (const [name, content] of writes) {
|
|
534
|
+
const full = path.join(outputDir, name);
|
|
535
|
+
const written = await writeIfAllowed(full, content, overwrite);
|
|
536
|
+
if (written) files.push(full);
|
|
537
|
+
}
|
|
538
|
+
return {
|
|
539
|
+
root,
|
|
540
|
+
outputDir,
|
|
541
|
+
files,
|
|
542
|
+
createdAt
|
|
543
|
+
};
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
// src/outcomeBoundFlow.ts
|
|
547
|
+
var OUTCOME_BOUND_FLOW_SCHEMA = "outcome-bound-autonomous-flow/v1";
|
|
548
|
+
var OUTCOME_BOUND_REQUIRED_GATES = [
|
|
549
|
+
"public_deploy_url",
|
|
550
|
+
"listing_updated",
|
|
551
|
+
"external_smoke_check",
|
|
552
|
+
"evidence_log",
|
|
553
|
+
"context_pack_preflight"
|
|
554
|
+
];
|
|
555
|
+
var isNonEmpty = (v) => typeof v === "string" && v.trim().length > 0;
|
|
556
|
+
var evaluateOutcomeBoundRun = (input) => {
|
|
557
|
+
const failedGates = [];
|
|
558
|
+
const reasons = [];
|
|
559
|
+
if (!isNonEmpty(input.publicDeployUrl)) {
|
|
560
|
+
failedGates.push("public_deploy_url");
|
|
561
|
+
reasons.push("Missing public deploy URL.");
|
|
562
|
+
}
|
|
563
|
+
if (!input.listingUpdated || !isNonEmpty(input.listingId)) {
|
|
564
|
+
failedGates.push("listing_updated");
|
|
565
|
+
reasons.push("Listing update is incomplete (listingUpdated/listingId required).");
|
|
566
|
+
}
|
|
567
|
+
if (!input.externalSmokeCheck?.passed) {
|
|
568
|
+
failedGates.push("external_smoke_check");
|
|
569
|
+
reasons.push("External smoke check did not pass.");
|
|
570
|
+
}
|
|
571
|
+
if (!isNonEmpty(input.evidenceLogPath)) {
|
|
572
|
+
failedGates.push("evidence_log");
|
|
573
|
+
reasons.push("Missing evidence log path.");
|
|
574
|
+
}
|
|
575
|
+
if (!input.contextPackPreflight?.passed) {
|
|
576
|
+
failedGates.push("context_pack_preflight");
|
|
577
|
+
reasons.push("Context-pack preflight did not pass.");
|
|
578
|
+
}
|
|
579
|
+
const passedCount = OUTCOME_BOUND_REQUIRED_GATES.length - failedGates.length;
|
|
580
|
+
const score = Number((passedCount / OUTCOME_BOUND_REQUIRED_GATES.length).toFixed(2));
|
|
581
|
+
const completed = failedGates.length === 0;
|
|
582
|
+
return {
|
|
583
|
+
schema: OUTCOME_BOUND_FLOW_SCHEMA,
|
|
584
|
+
runId: input.runId,
|
|
585
|
+
objective: input.objective,
|
|
586
|
+
completed,
|
|
587
|
+
failedGates,
|
|
588
|
+
score,
|
|
589
|
+
status: completed ? "pass" : "fail",
|
|
590
|
+
reasons,
|
|
591
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
592
|
+
};
|
|
593
|
+
};
|
|
594
|
+
var assertOutcomeBoundCompleted = (input) => {
|
|
595
|
+
const status = evaluateOutcomeBoundRun(input);
|
|
596
|
+
if (!status.completed) {
|
|
597
|
+
const details = status.reasons.join(" ");
|
|
598
|
+
throw new Error(`outcome_bound_incomplete:${status.failedGates.join(",")}${details ? `:${details}` : ""}`);
|
|
599
|
+
}
|
|
600
|
+
return status;
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
// src/strictMemoryRuntime.ts
|
|
604
|
+
var STRICT_MEMORY_RUNTIME_SCHEMA = "strict-memory-runtime/v1";
|
|
605
|
+
var DEFAULT_MUTATION_KEYWORDS = [
|
|
606
|
+
"deploy",
|
|
607
|
+
"restart",
|
|
608
|
+
"install",
|
|
609
|
+
"delete",
|
|
610
|
+
"remove",
|
|
611
|
+
"push",
|
|
612
|
+
"publish",
|
|
613
|
+
"release",
|
|
614
|
+
"migrate",
|
|
615
|
+
"config",
|
|
616
|
+
"cron",
|
|
617
|
+
"service",
|
|
618
|
+
"production",
|
|
619
|
+
"prod"
|
|
620
|
+
];
|
|
621
|
+
var DEFAULT_COMPLEX_KEYWORDS = [
|
|
622
|
+
"multi-step",
|
|
623
|
+
"cross-day",
|
|
624
|
+
"production",
|
|
625
|
+
"owner",
|
|
626
|
+
"id",
|
|
627
|
+
"listing",
|
|
628
|
+
"migration",
|
|
629
|
+
"incident",
|
|
630
|
+
"release",
|
|
631
|
+
"rollout",
|
|
632
|
+
"infra",
|
|
633
|
+
"security"
|
|
634
|
+
];
|
|
635
|
+
var uniq = (arr) => [...new Set(arr.map((s) => String(s).trim()).filter(Boolean))];
|
|
636
|
+
var createStrictMemoryRuntimePreset = (overrides = {}) => {
|
|
637
|
+
const base = {
|
|
638
|
+
schema: STRICT_MEMORY_RUNTIME_SCHEMA,
|
|
639
|
+
enabled: true,
|
|
640
|
+
requireContextPackForComplex: true,
|
|
641
|
+
requireSemanticRecallForComplex: true,
|
|
642
|
+
requireApprovalPreflightForMutations: true,
|
|
643
|
+
maxContextPackAgeMin: 180,
|
|
644
|
+
mutationKeywords: [...DEFAULT_MUTATION_KEYWORDS],
|
|
645
|
+
complexTaskTrigger: {
|
|
646
|
+
keywords: [...DEFAULT_COMPLEX_KEYWORDS],
|
|
647
|
+
minTaskChars: 80
|
|
648
|
+
},
|
|
649
|
+
upgradePolicy: {
|
|
650
|
+
mode: "observe",
|
|
651
|
+
safeUpgrade: {
|
|
652
|
+
backupBeforeEnable: true,
|
|
653
|
+
requireHealthcheckPass: true,
|
|
654
|
+
rollbackOnBlockRateAbove: 0.35
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
return {
|
|
659
|
+
...base,
|
|
660
|
+
...overrides,
|
|
661
|
+
mutationKeywords: uniq(overrides.mutationKeywords || base.mutationKeywords),
|
|
662
|
+
complexTaskTrigger: {
|
|
663
|
+
...base.complexTaskTrigger,
|
|
664
|
+
...overrides.complexTaskTrigger || {},
|
|
665
|
+
keywords: uniq(overrides.complexTaskTrigger?.keywords || base.complexTaskTrigger.keywords)
|
|
666
|
+
},
|
|
667
|
+
upgradePolicy: {
|
|
668
|
+
...base.upgradePolicy,
|
|
669
|
+
...overrides.upgradePolicy || {},
|
|
670
|
+
safeUpgrade: {
|
|
671
|
+
...base.upgradePolicy.safeUpgrade,
|
|
672
|
+
...overrides.upgradePolicy?.safeUpgrade || {}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
};
|
|
677
|
+
var includesAny = (text, words) => {
|
|
678
|
+
const low = text.toLowerCase();
|
|
679
|
+
return words.some((w) => low.includes(w.toLowerCase()));
|
|
680
|
+
};
|
|
681
|
+
var isComplexTask = (taskText, preset = createStrictMemoryRuntimePreset()) => {
|
|
682
|
+
const text = String(taskText || "").trim();
|
|
683
|
+
if (!text) return false;
|
|
684
|
+
if (text.length >= preset.complexTaskTrigger.minTaskChars) return true;
|
|
685
|
+
return includesAny(text, preset.complexTaskTrigger.keywords);
|
|
686
|
+
};
|
|
687
|
+
var evaluateStrictMemoryExecution = (input, preset = createStrictMemoryRuntimePreset()) => {
|
|
688
|
+
const complex = isComplexTask(input.taskText, preset);
|
|
689
|
+
const shouldEnforce = preset.enabled && (complex || input.isMutation);
|
|
690
|
+
const requiredSteps = [];
|
|
691
|
+
const missingSteps = [];
|
|
692
|
+
const reasons = [];
|
|
693
|
+
if (!shouldEnforce) {
|
|
694
|
+
return { complex, shouldEnforce, allowed: true, requiredSteps, missingSteps, reasons };
|
|
695
|
+
}
|
|
696
|
+
if (preset.requireContextPackForComplex && complex) {
|
|
697
|
+
requiredSteps.push("context_pack_prepared");
|
|
698
|
+
if (!input.contextPackPrepared) {
|
|
699
|
+
missingSteps.push("context_pack_prepared");
|
|
700
|
+
reasons.push("Missing context pack for complex task.");
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
if (preset.requireSemanticRecallForComplex && complex) {
|
|
704
|
+
requiredSteps.push("semantic_recall_confirmed");
|
|
705
|
+
if (!input.semanticRecallConfirmed) {
|
|
706
|
+
missingSteps.push("semantic_recall_confirmed");
|
|
707
|
+
reasons.push("Missing semantic recall confirmation for complex task.");
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
if (preset.requireApprovalPreflightForMutations && input.isMutation) {
|
|
711
|
+
requiredSteps.push("approval_preflight_passed");
|
|
712
|
+
if (!input.approvalPreflightPassed) {
|
|
713
|
+
missingSteps.push("approval_preflight_passed");
|
|
714
|
+
reasons.push("Mutation preflight approval did not pass.");
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
return {
|
|
718
|
+
complex,
|
|
719
|
+
shouldEnforce,
|
|
720
|
+
allowed: missingSteps.length === 0,
|
|
721
|
+
requiredSteps,
|
|
722
|
+
missingSteps,
|
|
723
|
+
reasons
|
|
724
|
+
};
|
|
725
|
+
};
|
|
726
|
+
var upgradeToStrictMemoryRuntimePreset = (input = {}) => {
|
|
727
|
+
const current = createStrictMemoryRuntimePreset(input.current || {});
|
|
728
|
+
const targetMode = input.targetMode || current.upgradePolicy.mode || "observe";
|
|
729
|
+
const next = createStrictMemoryRuntimePreset({
|
|
730
|
+
...current,
|
|
731
|
+
upgradePolicy: {
|
|
732
|
+
...current.upgradePolicy,
|
|
733
|
+
mode: targetMode
|
|
734
|
+
}
|
|
735
|
+
});
|
|
736
|
+
const reasons = [];
|
|
737
|
+
const safeCfg = next.upgradePolicy.safeUpgrade;
|
|
738
|
+
if (safeCfg.backupBeforeEnable && !input.backupCreated) {
|
|
739
|
+
reasons.push("Backup not confirmed.");
|
|
740
|
+
}
|
|
741
|
+
if (safeCfg.requireHealthcheckPass && !input.healthcheckPassed) {
|
|
742
|
+
reasons.push("Healthcheck not confirmed.");
|
|
743
|
+
}
|
|
744
|
+
if (typeof input.recentBlockRate === "number" && input.recentBlockRate > safeCfg.rollbackOnBlockRateAbove && targetMode === "enforce") {
|
|
745
|
+
reasons.push("Recent block rate is too high for enforce mode; keep observe mode first.");
|
|
746
|
+
}
|
|
747
|
+
return {
|
|
748
|
+
next,
|
|
749
|
+
safe: reasons.length === 0,
|
|
750
|
+
reasons
|
|
751
|
+
};
|
|
752
|
+
};
|
|
753
|
+
|
|
236
754
|
// src/index.ts
|
|
237
755
|
var SdkUpdateRequiredError = class extends Error {
|
|
238
756
|
status;
|
|
@@ -349,7 +867,7 @@ var ReviewGate = class {
|
|
|
349
867
|
var DEFAULT_API_BASE = "https://api.vibeiao.com";
|
|
350
868
|
var DEFAULT_WEB_BASE = "https://vibeiao.com";
|
|
351
869
|
var DEFAULT_SDK_PACKAGE = "@vibeiao/sdk";
|
|
352
|
-
var DEFAULT_SDK_VERSION = "0.1.
|
|
870
|
+
var DEFAULT_SDK_VERSION = "0.1.32" ? "0.1.32" : "0.1.4";
|
|
353
871
|
var DEFAULT_SDK_REGISTRY = "https://registry.npmjs.org";
|
|
354
872
|
var DEFAULT_SDK_POLICY_PATH = "/v1/sdk/policy";
|
|
355
873
|
var DEFAULT_SDK_CHECK_INTERVAL_MS = 1e3 * 60 * 30;
|
|
@@ -541,9 +1059,9 @@ var unwrap = (response) => {
|
|
|
541
1059
|
return response.data;
|
|
542
1060
|
};
|
|
543
1061
|
var normalizeProviderName = (value) => value.trim().toLowerCase().replace(/[^a-z0-9_-]/g, "");
|
|
544
|
-
var getByPath = (payload,
|
|
545
|
-
if (!
|
|
546
|
-
const segments =
|
|
1062
|
+
var getByPath = (payload, path2) => {
|
|
1063
|
+
if (!path2) return void 0;
|
|
1064
|
+
const segments = path2.split(".").map((part) => part.trim()).filter(Boolean);
|
|
547
1065
|
let current = payload;
|
|
548
1066
|
for (const segment of segments) {
|
|
549
1067
|
if (!current || typeof current !== "object" || !(segment in current)) {
|
|
@@ -844,9 +1362,9 @@ var VibeClient = class {
|
|
|
844
1362
|
};
|
|
845
1363
|
}
|
|
846
1364
|
}
|
|
847
|
-
async get(
|
|
1365
|
+
async get(path2) {
|
|
848
1366
|
await this.ensureLatestVersion();
|
|
849
|
-
const response = await this.fetcher(`${this.baseUrl}${
|
|
1367
|
+
const response = await this.fetcher(`${this.baseUrl}${path2}`);
|
|
850
1368
|
let payload = null;
|
|
851
1369
|
try {
|
|
852
1370
|
payload = await readJson(response);
|
|
@@ -862,9 +1380,9 @@ var VibeClient = class {
|
|
|
862
1380
|
}
|
|
863
1381
|
return payload;
|
|
864
1382
|
}
|
|
865
|
-
async post(
|
|
1383
|
+
async post(path2, body) {
|
|
866
1384
|
await this.ensureLatestVersion();
|
|
867
|
-
const response = await this.fetcher(`${this.baseUrl}${
|
|
1385
|
+
const response = await this.fetcher(`${this.baseUrl}${path2}`, {
|
|
868
1386
|
method: "POST",
|
|
869
1387
|
headers: { "Content-Type": "application/json" },
|
|
870
1388
|
body: JSON.stringify(body)
|
|
@@ -884,9 +1402,9 @@ var VibeClient = class {
|
|
|
884
1402
|
}
|
|
885
1403
|
return payload;
|
|
886
1404
|
}
|
|
887
|
-
async del(
|
|
1405
|
+
async del(path2, body) {
|
|
888
1406
|
await this.ensureLatestVersion();
|
|
889
|
-
const response = await this.fetcher(`${this.baseUrl}${
|
|
1407
|
+
const response = await this.fetcher(`${this.baseUrl}${path2}`, {
|
|
890
1408
|
method: "DELETE",
|
|
891
1409
|
headers: { "Content-Type": "application/json" },
|
|
892
1410
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
@@ -1466,17 +1984,23 @@ var getResourceSnapshot = async (options) => {
|
|
|
1466
1984
|
};
|
|
1467
1985
|
export {
|
|
1468
1986
|
CONTEXT_PACK_SECTION_ORDER,
|
|
1987
|
+
HUMAN_APP_LOOP_PHASES,
|
|
1988
|
+
HUMAN_APP_LOOP_SCHEMA,
|
|
1469
1989
|
LISTING_NAME_MAX_LENGTH,
|
|
1470
1990
|
LISTING_NAME_RECOMMENDED_MAX,
|
|
1471
1991
|
LISTING_TAGLINE_MAX_LENGTH,
|
|
1472
1992
|
LISTING_TAGLINE_RECOMMENDED_MAX,
|
|
1993
|
+
OUTCOME_BOUND_FLOW_SCHEMA,
|
|
1994
|
+
OUTCOME_BOUND_REQUIRED_GATES,
|
|
1473
1995
|
ReviewGate,
|
|
1996
|
+
STRICT_MEMORY_RUNTIME_SCHEMA,
|
|
1474
1997
|
SdkAutoUpdatedRestartRequiredError,
|
|
1475
1998
|
SdkUpdateRequiredError,
|
|
1476
1999
|
SelfReliance,
|
|
1477
2000
|
VIBEIAO_IDL,
|
|
1478
2001
|
VibeClient,
|
|
1479
2002
|
VibeRegistry,
|
|
2003
|
+
assertOutcomeBoundCompleted,
|
|
1480
2004
|
assertSurvivalProvidersConfigured,
|
|
1481
2005
|
buildBadgeMarkdown,
|
|
1482
2006
|
buildClaimMessage,
|
|
@@ -1509,9 +2033,11 @@ export {
|
|
|
1509
2033
|
createCampaign,
|
|
1510
2034
|
createContextPack,
|
|
1511
2035
|
createDurabilityProxyClient,
|
|
2036
|
+
createHumanAppLoopSpec,
|
|
1512
2037
|
createInMemoryReflectionStore,
|
|
1513
2038
|
createSelfRelianceMonitor,
|
|
1514
2039
|
createSelfReliancePolicy,
|
|
2040
|
+
createStrictMemoryRuntimePreset,
|
|
1515
2041
|
createSurvivalMiddleware,
|
|
1516
2042
|
createTreasuryPolicy,
|
|
1517
2043
|
decideProcurementForTask,
|
|
@@ -1519,6 +2045,9 @@ export {
|
|
|
1519
2045
|
discoverMarketNeeds,
|
|
1520
2046
|
estimateContextPackTokens,
|
|
1521
2047
|
evaluateEscapeHatch,
|
|
2048
|
+
evaluateHumanAppTrial,
|
|
2049
|
+
evaluateOutcomeBoundRun,
|
|
2050
|
+
evaluateStrictMemoryExecution,
|
|
1522
2051
|
evaluateTopupRequest,
|
|
1523
2052
|
extractMarketSignals,
|
|
1524
2053
|
fetchSolBalance,
|
|
@@ -1530,14 +2059,17 @@ export {
|
|
|
1530
2059
|
getSurvivalPlaybookDecision,
|
|
1531
2060
|
getSurvivalPlaybookDecisionFromSelfReliance,
|
|
1532
2061
|
getSurvivalRecommendation,
|
|
2062
|
+
isComplexTask,
|
|
1533
2063
|
normalizeListingText,
|
|
1534
2064
|
rankListingsForTask,
|
|
1535
2065
|
runMarketDiscovery,
|
|
1536
2066
|
runReflectionCycle,
|
|
1537
2067
|
sanitizeListingNaming,
|
|
2068
|
+
scaffoldHumanAppLoopPack,
|
|
1538
2069
|
scoreListingForTask,
|
|
1539
2070
|
scoreReviewPriority,
|
|
1540
2071
|
treasuryStateFromSnapshot,
|
|
2072
|
+
upgradeToStrictMemoryRuntimePreset,
|
|
1541
2073
|
validateContextPack,
|
|
1542
2074
|
validateListingNaming,
|
|
1543
2075
|
validateTreasuryPolicy,
|
|
@@ -825,6 +825,171 @@ declare const createDurabilityProxyClient: (options: DurabilityProxyClientOption
|
|
|
825
825
|
}>;
|
|
826
826
|
};
|
|
827
827
|
|
|
828
|
+
declare const HUMAN_APP_LOOP_SCHEMA = "human-app-reflective-loop/v1";
|
|
829
|
+
declare const HUMAN_APP_LOOP_PHASES: readonly ["research", "hypothesis", "build", "launch", "observe", "reflect", "iterate"];
|
|
830
|
+
type HumanAppLoopPhase = (typeof HUMAN_APP_LOOP_PHASES)[number];
|
|
831
|
+
type HumanAppPhaseContract = {
|
|
832
|
+
phase: HumanAppLoopPhase;
|
|
833
|
+
requiredInputs: string[];
|
|
834
|
+
requiredOutputs: string[];
|
|
835
|
+
goNoGoCriteria: string[];
|
|
836
|
+
stopOrRollbackConditions: string[];
|
|
837
|
+
kpis: string[];
|
|
838
|
+
};
|
|
839
|
+
type HumanAppLoopSpec = {
|
|
840
|
+
schema: typeof HUMAN_APP_LOOP_SCHEMA;
|
|
841
|
+
createdAt: string;
|
|
842
|
+
phases: HumanAppPhaseContract[];
|
|
843
|
+
optionalToolUsePolicy: {
|
|
844
|
+
enabled: true;
|
|
845
|
+
rules: string[];
|
|
846
|
+
};
|
|
847
|
+
overlapWithAgentListingLoops: {
|
|
848
|
+
overlap: string[];
|
|
849
|
+
differences: string[];
|
|
850
|
+
};
|
|
851
|
+
evaluationRubric: {
|
|
852
|
+
dimensions: Array<{
|
|
853
|
+
id: 'researchDepth' | 'iterationQuality' | 'outcomeUsefulness';
|
|
854
|
+
description: string;
|
|
855
|
+
weight: number;
|
|
856
|
+
passThreshold: number;
|
|
857
|
+
}>;
|
|
858
|
+
overallPassThreshold: number;
|
|
859
|
+
};
|
|
860
|
+
};
|
|
861
|
+
type HumanAppTrialInput = {
|
|
862
|
+
id: string;
|
|
863
|
+
summary?: string;
|
|
864
|
+
evidence: {
|
|
865
|
+
researchNotesCount: number;
|
|
866
|
+
hypothesisCount: number;
|
|
867
|
+
experimentsRun: number;
|
|
868
|
+
measurableKpiCount: number;
|
|
869
|
+
rollbackPlanPresent: boolean;
|
|
870
|
+
shippedArtifactPresent: boolean;
|
|
871
|
+
iterationSteps: number;
|
|
872
|
+
};
|
|
873
|
+
};
|
|
874
|
+
type HumanAppTrialEvaluation = {
|
|
875
|
+
id: string;
|
|
876
|
+
scores: {
|
|
877
|
+
researchDepth: number;
|
|
878
|
+
iterationQuality: number;
|
|
879
|
+
outcomeUsefulness: number;
|
|
880
|
+
};
|
|
881
|
+
weightedScore: number;
|
|
882
|
+
pass: boolean;
|
|
883
|
+
notes: string[];
|
|
884
|
+
};
|
|
885
|
+
declare const createHumanAppLoopSpec: (createdAt?: string) => HumanAppLoopSpec;
|
|
886
|
+
declare const evaluateHumanAppTrial: (trial: HumanAppTrialInput, spec?: HumanAppLoopSpec) => HumanAppTrialEvaluation;
|
|
887
|
+
type ScaffoldHumanAppLoopPackOptions = {
|
|
888
|
+
root?: string;
|
|
889
|
+
outputDir?: string;
|
|
890
|
+
overwrite?: boolean;
|
|
891
|
+
};
|
|
892
|
+
type ScaffoldHumanAppLoopPackResult = {
|
|
893
|
+
root: string;
|
|
894
|
+
outputDir: string;
|
|
895
|
+
files: string[];
|
|
896
|
+
createdAt: string;
|
|
897
|
+
};
|
|
898
|
+
declare const scaffoldHumanAppLoopPack: (options?: ScaffoldHumanAppLoopPackOptions) => Promise<ScaffoldHumanAppLoopPackResult>;
|
|
899
|
+
|
|
900
|
+
declare const OUTCOME_BOUND_FLOW_SCHEMA = "outcome-bound-autonomous-flow/v1";
|
|
901
|
+
type OutcomeBoundRequiredGate = 'public_deploy_url' | 'listing_updated' | 'external_smoke_check' | 'evidence_log' | 'context_pack_preflight';
|
|
902
|
+
declare const OUTCOME_BOUND_REQUIRED_GATES: OutcomeBoundRequiredGate[];
|
|
903
|
+
type OutcomeBoundRunInput = {
|
|
904
|
+
runId: string;
|
|
905
|
+
objective: string;
|
|
906
|
+
publicDeployUrl?: string;
|
|
907
|
+
listingId?: string;
|
|
908
|
+
listingUpdated: boolean;
|
|
909
|
+
externalSmokeCheck: {
|
|
910
|
+
passed: boolean;
|
|
911
|
+
checker?: string;
|
|
912
|
+
checkedAt?: string;
|
|
913
|
+
note?: string;
|
|
914
|
+
};
|
|
915
|
+
evidenceLogPath?: string;
|
|
916
|
+
contextPackPreflight: {
|
|
917
|
+
passed: boolean;
|
|
918
|
+
scope?: string;
|
|
919
|
+
preparedAt?: string;
|
|
920
|
+
};
|
|
921
|
+
notes?: string[];
|
|
922
|
+
};
|
|
923
|
+
type OutcomeBoundRunStatus = {
|
|
924
|
+
schema: typeof OUTCOME_BOUND_FLOW_SCHEMA;
|
|
925
|
+
runId: string;
|
|
926
|
+
objective: string;
|
|
927
|
+
completed: boolean;
|
|
928
|
+
failedGates: OutcomeBoundRequiredGate[];
|
|
929
|
+
score: number;
|
|
930
|
+
status: 'pass' | 'fail';
|
|
931
|
+
reasons: string[];
|
|
932
|
+
createdAt: string;
|
|
933
|
+
};
|
|
934
|
+
declare const evaluateOutcomeBoundRun: (input: OutcomeBoundRunInput) => OutcomeBoundRunStatus;
|
|
935
|
+
declare const assertOutcomeBoundCompleted: (input: OutcomeBoundRunInput) => OutcomeBoundRunStatus;
|
|
936
|
+
|
|
937
|
+
declare const STRICT_MEMORY_RUNTIME_SCHEMA = "strict-memory-runtime/v1";
|
|
938
|
+
type StrictMemoryTriggerSet = {
|
|
939
|
+
keywords: string[];
|
|
940
|
+
minTaskChars: number;
|
|
941
|
+
};
|
|
942
|
+
type StrictMemoryUpgradePolicy = {
|
|
943
|
+
mode: 'observe' | 'enforce';
|
|
944
|
+
safeUpgrade: {
|
|
945
|
+
backupBeforeEnable: boolean;
|
|
946
|
+
requireHealthcheckPass: boolean;
|
|
947
|
+
rollbackOnBlockRateAbove: number;
|
|
948
|
+
};
|
|
949
|
+
};
|
|
950
|
+
type StrictMemoryRuntimePreset = {
|
|
951
|
+
schema: typeof STRICT_MEMORY_RUNTIME_SCHEMA;
|
|
952
|
+
enabled: boolean;
|
|
953
|
+
requireContextPackForComplex: boolean;
|
|
954
|
+
requireSemanticRecallForComplex: boolean;
|
|
955
|
+
requireApprovalPreflightForMutations: boolean;
|
|
956
|
+
maxContextPackAgeMin: number;
|
|
957
|
+
mutationKeywords: string[];
|
|
958
|
+
complexTaskTrigger: StrictMemoryTriggerSet;
|
|
959
|
+
upgradePolicy: StrictMemoryUpgradePolicy;
|
|
960
|
+
};
|
|
961
|
+
type StrictMemoryEvaluationInput = {
|
|
962
|
+
taskText: string;
|
|
963
|
+
isMutation: boolean;
|
|
964
|
+
contextPackPrepared: boolean;
|
|
965
|
+
semanticRecallConfirmed: boolean;
|
|
966
|
+
approvalPreflightPassed: boolean;
|
|
967
|
+
};
|
|
968
|
+
type StrictMemoryEvaluation = {
|
|
969
|
+
complex: boolean;
|
|
970
|
+
shouldEnforce: boolean;
|
|
971
|
+
allowed: boolean;
|
|
972
|
+
requiredSteps: string[];
|
|
973
|
+
missingSteps: string[];
|
|
974
|
+
reasons: string[];
|
|
975
|
+
};
|
|
976
|
+
type StrictMemoryUpgradeInput = {
|
|
977
|
+
current?: Partial<StrictMemoryRuntimePreset>;
|
|
978
|
+
healthcheckPassed?: boolean;
|
|
979
|
+
backupCreated?: boolean;
|
|
980
|
+
recentBlockRate?: number;
|
|
981
|
+
targetMode?: 'observe' | 'enforce';
|
|
982
|
+
};
|
|
983
|
+
type StrictMemoryUpgradeResult = {
|
|
984
|
+
next: StrictMemoryRuntimePreset;
|
|
985
|
+
safe: boolean;
|
|
986
|
+
reasons: string[];
|
|
987
|
+
};
|
|
988
|
+
declare const createStrictMemoryRuntimePreset: (overrides?: Partial<StrictMemoryRuntimePreset>) => StrictMemoryRuntimePreset;
|
|
989
|
+
declare const isComplexTask: (taskText: string, preset?: StrictMemoryRuntimePreset) => boolean;
|
|
990
|
+
declare const evaluateStrictMemoryExecution: (input: StrictMemoryEvaluationInput, preset?: StrictMemoryRuntimePreset) => StrictMemoryEvaluation;
|
|
991
|
+
declare const upgradeToStrictMemoryRuntimePreset: (input?: StrictMemoryUpgradeInput) => StrictMemoryUpgradeResult;
|
|
992
|
+
|
|
828
993
|
interface VibeClientOptions {
|
|
829
994
|
baseUrl?: string;
|
|
830
995
|
fetcher?: typeof fetch;
|
|
@@ -1284,4 +1449,4 @@ declare const getResourceSnapshot: (options: {
|
|
|
1284
1449
|
apiBase?: string;
|
|
1285
1450
|
}) => Promise<ResourceSnapshot>;
|
|
1286
1451
|
|
|
1287
|
-
export {
|
|
1452
|
+
export { ReviewGate as $, type AgentResourceProvidersManifest as A, type BuybackEvent as B, CONTEXT_PACK_SECTION_ORDER as C, type DurabilityCheckpointWriteOptions as D, type ListingNamingValidationResult as E, type ListingQuery as F, type ListingReviewCreatePayload as G, HUMAN_APP_LOOP_PHASES 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, OUTCOME_BOUND_FLOW_SCHEMA as P, OUTCOME_BOUND_REQUIRED_GATES as Q, type OpenRouterCredits as R, type OutcomeBoundRequiredGate as S, type OutcomeBoundRunInput as T, type TopupDecision, type TopupRequest, type TreasuryLedgerEvent, type TreasuryPolicy, type TreasuryPolicyV1, type TreasuryState, type OutcomeBoundRunStatus as U, type ProcurementCandidate as V, type ProcurementDecision as W, type ProcurementTaskProfile as X, type ProcurementWeights as Y, type ResourceProviderManifestEntry as Z, type ResourceSnapshot as _, type AnalyticsPoint as a, validateListingNaming as a$, type ReviewGateRecord as a0, type ReviewRequiredPayload as a1, STRICT_MEMORY_RUNTIME_SCHEMA as a2, type ScaffoldHumanAppLoopPackOptions as a3, type ScaffoldHumanAppLoopPackResult as a4, SdkAutoUpdatedRestartRequiredError as a5, type SdkUpdateCheckOptions as a6, type SdkUpdatePolicyCheckOptions as a7, SdkUpdateRequiredError as a8, type SdkUpdateStatus as a9, buildShareLink as aA, buildTradeLinks as aB, checkForSdkUpdate as aC, checkForSdkUpdatePolicy as aD, compareVersions as aE, createApiCreditProvider as aF, createApiCreditProviders as aG, createApiCreditProvidersFromManifest as aH, createCampaign as aI, createContextPack as aJ, createDurabilityProxyClient as aK, createHumanAppLoopSpec as aL, createStrictMemoryRuntimePreset as aM, decideProcurementForTask as aN, estimateContextPackTokens as aO, evaluateHumanAppTrial as aP, evaluateOutcomeBoundRun as aQ, evaluateStrictMemoryExecution as aR, getResourceSnapshot as aS, isComplexTask as aT, normalizeListingText as aU, rankListingsForTask as aV, sanitizeListingNaming as aW, scaffoldHumanAppLoopPack as aX, scoreListingForTask as aY, upgradeToStrictMemoryRuntimePreset as aZ, validateContextPack as a_, type StrictMemoryEvaluation as aa, type StrictMemoryEvaluationInput as ab, type StrictMemoryRuntimePreset as ac, type StrictMemoryTriggerSet as ad, type StrictMemoryUpgradeInput as ae, type StrictMemoryUpgradePolicy as af, type StrictMemoryUpgradeResult as ag, VIBEIAO_IDL as ah, VibeClient as ai, type VibeClientOptions as aj, VibeRegistry as ak, assertOutcomeBoundCompleted as al, assertSurvivalProvidersConfigured as am, buildBadgeMarkdown as an, buildClaimMessage as ao, buildJupiterSwapUrl as ap, buildListingVersionMessage as aq, buildMemoryPingMessage as ar, buildOwnerTransferMessage as as, buildProcurementPrompt as at, buildRaydiumSwapUrl as au, buildReviewPrompt as av, buildReviewRequired as aw, buildReviewResponseMessage as ax, buildSdkUpdateCommand as ay, buildShareCopy as az, type ApiCreditProvider as b, buildTreasuryLedgerEvent, type ApiCreditProviderFactoryOptions as c, createTreasuryPolicy, type ApiCreditProviderPreset as d, type ApiCreditProviderPresetInput as e, evaluateTopupRequest, type ApiResponse as f, type ContextPack as g, type ContextPackBudget as h, type ContextPackInput as i, type ContextPackOptions as j, type ContextPackSectionKey as k, type ContextPackSections as l, type DurabilityProxyClientOptions as m, type DurabilityRestoreDrillWriteOptions as n, HUMAN_APP_LOOP_SCHEMA as o, type HumanAppLoopPhase as p, type HumanAppLoopSpec as q, type HumanAppPhaseContract as r, type HumanAppTrialEvaluation as s, type HumanAppTrialInput as t, treasuryStateFromSnapshot, LISTING_NAME_RECOMMENDED_MAX as u, LISTING_TAGLINE_MAX_LENGTH as v, validateTreasuryPolicy, LISTING_TAGLINE_RECOMMENDED_MAX as w, type LeaderboardEntry as x, type LeaderboardQuery as y, type ListingNamingValidationOptions as z };
|