@aviaratech/ai-delivery 0.3.17 → 0.3.19

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
@@ -325,6 +325,13 @@ comment's native ID. The operator attests that all other launchers and writers
325
325
  are quiescent and remain excluded through recovery. The existing writer slot
326
326
  must be absent; this flow never recovers or terminates an unknown writer.
327
327
 
328
+ For this committed-descendant case only, a complete empty native closing-issue
329
+ connection may instead bind an explicit `Refs #<issue>` reference, with optional
330
+ explanatory text, to complete native issue-timeline cross-reference evidence for
331
+ the same PR, repository and authenticated historical author before the merge. The PR body alone is
332
+ insufficient. Missing, incomplete or mismatched native evidence is refused;
333
+ other worktree transition purposes retain their closing-issue requirement.
334
+
328
335
  Repeat `develop` or existing-issue `start` after interruption. Recovery checks
329
336
  the same pinned native comments, revocation, original bytes and exact original
330
337
  or replacement row before completing. Other mutations, including metadata
@@ -427,6 +434,80 @@ proof. A stopped or failed publish/finish must be read back before retrying;
427
434
  never infer completion from a timed-out command. Task assignment and model
428
435
  routing belong to a separate orchestrator, not this CLI.
429
436
 
437
+ ## Bounded issue source phases
438
+
439
+ The root and `@aviaratech/ai-delivery/agent` exports provide
440
+ `withIssueSourcePhase(input, async context => { ... })` for an expressly
441
+ authorized source graph in an existing registered issue worktree. The input
442
+ binds its exact row and ownership witness, configured authenticated author,
443
+ admitted executing SDK, primary controller HEAD/configuration, and separate
444
+ candidate HEAD/index/dirty files/configuration. Declare frozen caller and input
445
+ artifact digests, resolved command executables/argv/cwd, effective environment
446
+ digest and overrides, completion artifacts, disjoint output roots and fixed
447
+ RSS/output/disk bounds. Environment values stay in memory; records contain its
448
+ digest. The selected SDK's producer commit and the consumer controller HEAD
449
+ are separate identities.
450
+
451
+ `identity` selects the configured authenticated author. Historical worktree
452
+ custody may name a different principal: the exact canonical row digest and
453
+ ownership witness remain bound and unchanged throughout the phase. The receipt
454
+ binds that row separately from its authenticated actor; entering a source phase
455
+ does not transfer custody or alias those principals.
456
+
457
+ Inside the callback, prepare owned metadata and `await context.run(index)` for
458
+ every command, in order, once. The context exposes read-only source,
459
+ controller, authenticated actor and input identities. It permits one active
460
+ command and expires when the callback settles. An unawaited command cancels
461
+ the phase and triggers identity-bound descendant cleanup. This is a trusted
462
+ cooperative callback: use its AbortSignal and issue all subprocesses through
463
+ `run`. JavaScript is not sandboxed. Source must preserve the exact initial
464
+ snapshot or produce the one declared commit with its exact parent/tree and
465
+ clean postconditions. Normal commit hooks remain enabled.
466
+
467
+ For a declared candidate policy change, set the optional
468
+ `source.effect.configDigest` on `commitOnce` to the final resolved candidate
469
+ configuration digest. `source.configDigest` binds the initial configuration;
470
+ the final digest applies only to the exact declared clean child commit. Resolve
471
+ both digests through the SDK's configuration loader; a policy file hash is not
472
+ a resolved configuration digest. Omitting the final digest requires the initial
473
+ configuration throughout and preserves existing record identities. `preserve`
474
+ does not accept a final digest. The controller configuration remains fixed.
475
+
476
+ The existing writer fence is published before lengthy validation/scans. The
477
+ same runner accounts for the controller and owned descendants, captured logs,
478
+ callback output and SDK metadata under one original cumulative physical
479
+ baseline. New command calls cannot replace the graph, environment, roots or
480
+ allocation. Cancellation and lock compromise cancel owned work; process
481
+ cleanup, output accounting, writer release and lock release failures remain
482
+ distinct. Completion is sealed only after accounting and confirmed release.
483
+ The shared writer admission check continues to exclude other worktree writers
484
+ while this source-phase record is unsealed, including the release-to-seal interval.
485
+
486
+ The finite private `ai-delivery.source-phase@1` record is stored beneath the
487
+ Git common directory's `ai-delivery/receipts/source-phase@1`, keyed by worktree
488
+ and complete input digests. A compatible completed record can be returned
489
+ without entering the callback or replaying commands after validating source,
490
+ producer, admission and artifacts. A terminal `failed-quiescent` or
491
+ `rejected-before-work` attempt can be followed only by an expressly authorized
492
+ new input naming its exact predecessor phaseId/recordId, original baselineId
493
+ when present, and authorization digest in `reconciliation`. Retain original
494
+ source/runtime/input and allocation bindings and all output/bootstrap charges;
495
+ corrected rejected inputs supply no reusable proof. Intermediate command
496
+ results are never replay checkpoints. A missing or mistyped predecessor can be
497
+ corrected without discarding its rejected record: validated retention edges
498
+ carry every rejected sibling's bootstrap charge, separately from the requested
499
+ reconciliation and any reusable source/runtime proof. Every attempt inherits
500
+ the retained original allocation and charges prior attempts before checking
501
+ work authorization. Rejected requests cannot enlarge that allocation or change
502
+ its roots. Exhaustion remains unresolved and refuses another record or writer
503
+ claim. Interrupted intent, uncertain commits,
504
+ changed frozen inputs or unconfirmed release remain unresolved and refuse a
505
+ new attempt; the API supplies no previous-process recovery or force-unblock.
506
+
507
+ Its receipt proves this bounded operation only. Canonical verification,
508
+ independent acceptance, scientific holds and receiving runtime selection keep
509
+ their existing owners and checks.
510
+
430
511
  ## Compatibility contract
431
512
 
432
513
  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,y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