@aviaratech/ai-delivery 0.3.17 → 0.3.18

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
@@ -427,6 +427,71 @@ proof. A stopped or failed publish/finish must be read back before retrying;
427
427
  never infer completion from a timed-out command. Task assignment and model
428
428
  routing belong to a separate orchestrator, not this CLI.
429
429
 
430
+ ## Bounded issue source phases
431
+
432
+ The root and `@aviaratech/ai-delivery/agent` exports provide
433
+ `withIssueSourcePhase(input, async context => { ... })` for an expressly
434
+ authorized source graph in an existing registered issue worktree. The input
435
+ binds its exact row and ownership witness, configured authenticated author,
436
+ admitted executing SDK, primary controller HEAD/configuration, and separate
437
+ candidate HEAD/index/dirty files/configuration. Declare frozen caller and input
438
+ artifact digests, resolved command executables/argv/cwd, effective environment
439
+ digest and overrides, completion artifacts, disjoint output roots and fixed
440
+ RSS/output/disk bounds. Environment values stay in memory; records contain its
441
+ digest. The selected SDK's producer commit and the consumer controller HEAD
442
+ are separate identities.
443
+
444
+ `identity` selects the configured authenticated author. Historical worktree
445
+ custody may name a different principal: the exact canonical row digest and
446
+ ownership witness remain bound and unchanged throughout the phase. The receipt
447
+ binds that row separately from its authenticated actor; entering a source phase
448
+ does not transfer custody or alias those principals.
449
+
450
+ Inside the callback, prepare owned metadata and `await context.run(index)` for
451
+ every command, in order, once. The context exposes read-only source,
452
+ controller, authenticated actor and input identities. It permits one active
453
+ command and expires when the callback settles. An unawaited command cancels
454
+ the phase and triggers identity-bound descendant cleanup. This is a trusted
455
+ cooperative callback: use its AbortSignal and issue all subprocesses through
456
+ `run`. JavaScript is not sandboxed. Source must preserve the exact initial
457
+ snapshot or produce the one declared commit with its exact parent/tree and
458
+ clean postconditions. Normal commit hooks remain enabled.
459
+
460
+ The existing writer fence is published before lengthy validation/scans. The
461
+ same runner accounts for the controller and owned descendants, captured logs,
462
+ callback output and SDK metadata under one original cumulative physical
463
+ baseline. New command calls cannot replace the graph, environment, roots or
464
+ allocation. Cancellation and lock compromise cancel owned work; process
465
+ cleanup, output accounting, writer release and lock release failures remain
466
+ distinct. Completion is sealed only after accounting and confirmed release.
467
+ The shared writer admission check continues to exclude other worktree writers
468
+ while this source-phase record is unsealed, including the release-to-seal interval.
469
+
470
+ The finite private `ai-delivery.source-phase@1` record is stored beneath the
471
+ Git common directory's `ai-delivery/receipts/source-phase@1`, keyed by worktree
472
+ and complete input digests. A compatible completed record can be returned
473
+ without entering the callback or replaying commands after validating source,
474
+ producer, admission and artifacts. A terminal `failed-quiescent` or
475
+ `rejected-before-work` attempt can be followed only by an expressly authorized
476
+ new input naming its exact predecessor phaseId/recordId, original baselineId
477
+ when present, and authorization digest in `reconciliation`. Retain original
478
+ source/runtime/input and allocation bindings and all output/bootstrap charges;
479
+ corrected rejected inputs supply no reusable proof. Intermediate command
480
+ results are never replay checkpoints. A missing or mistyped predecessor can be
481
+ corrected without discarding its rejected record: validated retention edges
482
+ carry every rejected sibling's bootstrap charge, separately from the requested
483
+ reconciliation and any reusable source/runtime proof. Every attempt inherits
484
+ the retained original allocation and charges prior attempts before checking
485
+ work authorization. Rejected requests cannot enlarge that allocation or change
486
+ its roots. Exhaustion remains unresolved and refuses another record or writer
487
+ claim. Interrupted intent, uncertain commits,
488
+ changed frozen inputs or unconfirmed release remain unresolved and refuse a
489
+ new attempt; the API supplies no previous-process recovery or force-unblock.
490
+
491
+ Its receipt proves this bounded operation only. Canonical verification,
492
+ independent acceptance, scientific holds and receiving runtime selection keep
493
+ their existing owners and checks.
494
+
430
495
  ## Compatibility contract
431
496
 
432
497
  The MCP input and result contract is `ai-delivery.mcp@1`, exported as `AI_DELIVERY_MCP_CONTRACT_VERSION`. It retains the 13 `issue_*` tool names. Each tool rejects unknown fields at the request boundary. `issue_create` accepts a title with optional body, Issue Type, Points, Priority, taxonomy labels, milestone, parent and blockers; it returns `{body, created: {number, title, url}, routing}`. A linked parent is read back and cleared of Points. `issue_start({issueNumber})` always checks readiness and prepares that existing issue; `develop` gates only preparation of a newly created issue. New starts default to 2 Points. `resumeCreated` requires both `issueNumber` and `develop: true` and never creates a second issue. Immediate creation and development preflights readiness before creation and returns `ai-delivery.issue-start-registration@1` with `status: "started"` or a `created-not-started` failure and exact `safeResume` arguments. The CLI prints that recovery JSON and exits nonzero for `created-not-started`. Scratch starts derive safe names from the request or title and return the branch and worktree path. `repo` on create, start and ready check, or global CLI `--repo`, must match the repository selected by the checkout's validated Git remote; a mismatch fails before a GitHub call.
package/dist/agent.d.ts CHANGED
@@ -14,7 +14,8 @@ export { buildVelocityReport, getDeliveryRecords, recordMergedDelivery } from '.
14
14
  export type { DeliveryRecord, VelocityReport, PointBucketStatistics } from './services/deliveryRecordService.js';
15
15
  export { getIssueWorktreeStrict, listWorktreesStrict } from './services/worktreeRegistry.js';
16
16
  export { prepareIssueWorktree, prepareStandaloneWorktree } from './worktree.js';
17
- export { verifyIssue, createIssuePhaseEvidence, withVerificationFilesystemFixture } from './verification.js';
17
+ export { verifyIssue, createIssuePhaseEvidence, withVerificationFilesystemFixture, withIssueSourcePhase, } from './verification.js';
18
+ export type { IssueSourcePhaseInput, IssueSourcePhaseContext, IssueSourcePhaseReceipt } from './verification.js';
18
19
  export { discoverDeliveryRouting } from './github/discovery.js';
19
20
  export type { DeliveryRouting, DiscoveryClients } from './github/discovery.js';
20
21
  export type { DeliveryOverrides, DeliveryPolicySettings, LoadedDeliverySettings } from './config/deliveryConfig.js';
package/dist/agent.js CHANGED
@@ -12,7 +12,7 @@ export { normalizeLegacyIssue, planOfflineLegacyIssueMigration } from './service
12
12
  export { buildVelocityReport, getDeliveryRecords, recordMergedDelivery } from './services/deliveryRecordService.js';
13
13
  export { getIssueWorktreeStrict, listWorktreesStrict } from './services/worktreeRegistry.js';
14
14
  export { prepareIssueWorktree, prepareStandaloneWorktree } from './worktree.js';
15
- export { verifyIssue, createIssuePhaseEvidence, withVerificationFilesystemFixture } from './verification.js';
15
+ export { verifyIssue, createIssuePhaseEvidence, withVerificationFilesystemFixture, withIssueSourcePhase, } from './verification.js';
16
16
  export { discoverDeliveryRouting } from './github/discovery.js';
17
17
  export { stageRuntime, admitRuntime, RuntimeAdmissionCommitUnknownError } from './setup.js';
18
18
  //# sourceMappingURL=agent.js.map
package/dist/agent.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,8BAA8B,GAC/B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,gCAAgC,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AACpH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC/G,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,kBAAkB,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACrH,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,EAC9B,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AAC3G,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAA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