@tiangong-ai/cli 0.0.35 → 0.0.37

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.
Files changed (47) hide show
  1. package/AGENTS.md +16 -6
  2. package/README.md +128 -10
  3. package/dist/research/orchestration.js +334 -29
  4. package/dist/research/orchestration.js.map +1 -1
  5. package/dist/research/workspace/acquisition-routes.d.ts +14 -0
  6. package/dist/research/workspace/acquisition-routes.js +45 -0
  7. package/dist/research/workspace/acquisition-routes.js.map +1 -0
  8. package/dist/research/workspace/audit-bundle.d.ts +44 -0
  9. package/dist/research/workspace/audit-bundle.js +357 -0
  10. package/dist/research/workspace/audit-bundle.js.map +1 -0
  11. package/dist/research/workspace/broker.js +54 -10
  12. package/dist/research/workspace/broker.js.map +1 -1
  13. package/dist/research/workspace/downloads.d.ts +6 -0
  14. package/dist/research/workspace/downloads.js +32 -8
  15. package/dist/research/workspace/downloads.js.map +1 -1
  16. package/dist/research/workspace/evidence-exhaustion.d.ts +45 -0
  17. package/dist/research/workspace/evidence-exhaustion.js +365 -0
  18. package/dist/research/workspace/evidence-exhaustion.js.map +1 -0
  19. package/dist/research/workspace/native-activity.d.ts +6 -0
  20. package/dist/research/workspace/native-activity.js +24 -7
  21. package/dist/research/workspace/native-activity.js.map +1 -1
  22. package/dist/research/workspace/preflight.d.ts +34 -2
  23. package/dist/research/workspace/preflight.js +161 -1
  24. package/dist/research/workspace/preflight.js.map +1 -1
  25. package/dist/research/workspace/projects.d.ts +28 -4
  26. package/dist/research/workspace/projects.js +301 -12
  27. package/dist/research/workspace/projects.js.map +1 -1
  28. package/dist/research/workspace/publication-workflow.js +2 -0
  29. package/dist/research/workspace/publication-workflow.js.map +1 -1
  30. package/dist/research/workspace/runtime.d.ts +151 -3
  31. package/dist/research/workspace/runtime.js +180 -6
  32. package/dist/research/workspace/runtime.js.map +1 -1
  33. package/dist/research/workspace/sanitization.js +9 -3
  34. package/dist/research/workspace/sanitization.js.map +1 -1
  35. package/dist/research/workspace/scientific-design.d.ts +359 -0
  36. package/dist/research/workspace/scientific-design.js +2021 -0
  37. package/dist/research/workspace/scientific-design.js.map +1 -0
  38. package/dist/research/workspace/scientific-review.d.ts +101 -0
  39. package/dist/research/workspace/scientific-review.js +1167 -0
  40. package/dist/research/workspace/scientific-review.js.map +1 -0
  41. package/dist/research/workspace/setup-catalog.js +2 -2
  42. package/dist/research/workspace/setup.js +12 -3
  43. package/dist/research/workspace/setup.js.map +1 -1
  44. package/dist/research/workspace/types.d.ts +54 -0
  45. package/dist/research/workspace/workspace.js +25 -7
  46. package/dist/research/workspace/workspace.js.map +1 -1
  47. package/package.json +2 -1
package/AGENTS.md CHANGED
@@ -11,12 +11,14 @@ checkPaths:
11
11
  - AGENTS.md
12
12
  - README.md
13
13
  - package.json
14
+ - .dockerignore
15
+ - Dockerfile.clean-test
14
16
  - .github/workflows/**
15
17
  - .docpact/config.yaml
16
18
  - docs/agents/**
17
19
  - src/**
18
- lastReviewedAt: 2026-08-13
19
- lastReviewedCommit: df263405bccb21cd5838d92d82dccf80ca01acb1
20
+ lastReviewedAt: 2026-08-16
21
+ lastReviewedCommit: 622103bad4c33f09cfadda86d68f8ef113fa6804
20
22
  ---
21
23
 
22
24
  # Tiangong AI CLI Contract
@@ -62,7 +64,7 @@ This repository owns the Tiangong AI command-line interface.
62
64
  Run before delivery:
63
65
 
64
66
  ```bash
65
- npm run test:clean
67
+ npm run test:clean:cold
66
68
  npm run lint
67
69
  npm run build
68
70
  npm test
@@ -71,9 +73,17 @@ docpact validate-config --root . --strict
71
73
  docpact lint --root . --worktree --mode enforce
72
74
  ```
73
75
 
74
- For Auto Research changes, `npm run test:clean` is the authoritative TDD gate.
75
- Write the regression first, observe it fail in that clean container, then make
76
- it pass there. Host-only results are supplemental.
76
+ For Auto Research changes, `npm run test:clean` is the iterative authoritative
77
+ TDD gate. It may reuse input-valid Docker build layers, but every invocation
78
+ runs the tests in a separately created offline container with isolated HOME and
79
+ temporary filesystems. Write the regression first, observe it fail there, then
80
+ make it pass in another fresh container. Host-only results are supplemental.
81
+
82
+ Run `npm run test:clean:cold` after changing `.dockerignore`, the clean-test
83
+ Dockerfile, a dependency manifest or lockfile, and before delivery. Hosted PR
84
+ and publish workflows use this cold mode explicitly; it adds `--no-cache` but
85
+ does not use `--pull`, because base versions change only through reviewed digest
86
+ updates.
77
87
 
78
88
  Use `npm run typecheck` for a faster TypeScript-only check.
79
89
  Use `npm run prepush:gate` when `docpact` is installed and you want the
package/README.md CHANGED
@@ -12,8 +12,8 @@ checkPaths:
12
12
  - package.json
13
13
  - bin/**
14
14
  - src/**
15
- lastReviewedAt: 2026-08-12
16
- lastReviewedCommit: ac34420a63cb02898f8c38b1c1af64f0439e862f
15
+ lastReviewedAt: 2026-08-16
16
+ lastReviewedCommit: b8c2d6acaf44de0b9c7ea4530e54baff84ad034b
17
17
  ---
18
18
 
19
19
  # Tiangong AI CLI
@@ -269,7 +269,7 @@ regular non-symlink `runtime-lock.json` exact stable CLI version. Setup and
269
269
  release CI reject a missing resolver or any stale exact CLI version in the
270
270
  orchestrator's `SKILL.md` or `references/*.md`.
271
271
 
272
- ### Top-journal Research Policy and final publication gate
272
+ ### Top-journal Policy, scientific design, and publication gates
273
273
 
274
274
  A `top-journal` project starts with a human-reviewed Markdown Policy, not with
275
275
  model execution. After project-scoped setup reaches `READY`, use the guided
@@ -292,22 +292,86 @@ binds the manifest and every document by SHA-256; edits, manifest tampering, or
292
292
  expiry block preflight and all later stages until the Policy is reviewed and
293
293
  approved again.
294
294
 
295
- Use the Policy project ID when admitting the research project:
295
+ Before search, the current native Codex or Claude host must author a
296
+ project-specific scientific design. The CLI owns the closed schema and rejects
297
+ designs that confuse model-to-model disagreement with observed truth, inflate
298
+ independent sample size through resampling, omit quantity/threshold semantics,
299
+ leave blocking gaps unresolved, or cannot fit the complete review lifecycle.
300
+ The CLI validates, freezes, hashes, and routes this design; it does not author
301
+ the design or launch a nested producer.
302
+
303
+ Hash binding alone does not make a model executable. Each model declares raw
304
+ implementation bytes, a retrievable safe locator and entrypoint, exact
305
+ environment-lock bytes, implementation/environment status, and a freeze gate.
306
+ Source-derived uncertainty states also declare whether their values are frozen
307
+ or pending, and every joint state maps exact parameter-state IDs. Pending model,
308
+ environment, or uncertainty objects are allowed only when a planned Policy rule
309
+ owns the same due gate. They are exposed in every earlier review packet as
310
+ `futureGateObligations` and become blocking mechanical errors at that gate.
311
+ Freezing them requires a new authoritative generation; it never upgrades the
312
+ old object in place.
313
+
314
+ Use the same Policy project ID and exact design when preflighting and admitting
315
+ the research project:
296
316
 
297
317
  ```bash
318
+ tiangong-ai research schema show scientific-design --json
298
319
  tiangong-ai research project preflight \
299
320
  --question "A specific, testable research question" \
300
321
  --goal top-journal --policy-project top-journal-paper \
301
322
  --requirements /absolute/path/to/evidence-requirements.json \
323
+ --design /absolute/path/to/scientific-design.json \
324
+ --workspace /absolute/path/to/workspace --json
325
+ tiangong-ai research project init top-journal-paper \
326
+ --question "A specific, testable research question" \
327
+ --goal top-journal \
328
+ --requirements /absolute/path/to/evidence-requirements.json \
329
+ --design /absolute/path/to/scientific-design.json \
330
+ --design-producer-agent codex \
331
+ --design-producer-session OPAQUE_NATIVE_SESSION \
332
+ --confirm-budget \
302
333
  --workspace /absolute/path/to/workspace --json
303
334
  ```
304
335
 
305
336
  The base evidence lifecycle remains
306
337
  `discover -> acquire -> analyze -> synthesize -> review -> close`, authored in
307
- the current interactive Codex or Claude Code host. After base closure, the
308
- current native host writes a final manuscript and schema-valid publication
309
- assessment. `research publication freeze` then content-addresses the Policy,
310
- evidence snapshot, base outputs, manuscript, assessment, and supplements.
338
+ the current interactive Codex or Claude Code host. A fresh independent reviewer
339
+ must first pass three hash-bound scientific gates: `research-design` before
340
+ discovery, a real-record and outcome-blind `evidence-construct` canary after
341
+ discovery and before acquisition, and `pilot-methods` after acquisition and
342
+ before analysis. Reviewer prose cannot override a mechanical failure.
343
+
344
+ ```bash
345
+ tiangong-ai research schema show scientific-assessment-research-design --json
346
+ tiangong-ai research project scientific review prepare top-journal-paper \
347
+ --role research-design \
348
+ --assessment /absolute/path/to/research-design-assessment.json \
349
+ --reviewer-agent claude \
350
+ --reviewer-session FRESH_OPAQUE_REVIEW_SESSION \
351
+ --workspace /absolute/path/to/workspace --json
352
+ tiangong-ai research schema show scientific-review-research-design --json
353
+ tiangong-ai research project scientific review submit top-journal-paper \
354
+ --role research-design --review /absolute/path/to/review.json \
355
+ --workspace /absolute/path/to/workspace --json
356
+ ```
357
+
358
+ Repeat the same prepare/submit route for `evidence-construct` and
359
+ `pilot-methods` at their stage boundaries. A top-journal fork or addendum is a
360
+ new authoritative generation and therefore requires a target-specific approved
361
+ Policy, design, and fresh native producer session; it cannot inherit scientific
362
+ approval from a superseded generation.
363
+
364
+ Review packet `stageInputs` identify promoted portable objects by purpose,
365
+ owner, source locator, and SHA-256 over raw file bytes. `packetSha256` is the
366
+ logical packet identity that excludes its own identity field; the portable
367
+ audit manifest separately records the raw stored packet-file digest. This keeps
368
+ packet identity and byte-level transfer verification explicit rather than
369
+ overloading one hash with both meanings.
370
+
371
+ After base closure, the current native host writes a final manuscript and
372
+ schema-valid publication assessment. `research publication freeze` then
373
+ content-addresses the Policy, scientific design and early reviews, evidence
374
+ snapshot, base outputs, manuscript, assessment, and supplements.
311
375
  Exactly four fresh independent sessions review that frozen generation:
312
376
  evidence, methods/reproducibility, domain/novelty, and journal-editor. A revised
313
377
  manuscript invalidates prior reviews; reviewer-session reuse is rejected from
@@ -332,6 +396,21 @@ The CLI returns a mechanically bounded ceiling:
332
396
  `target-journal-submission-ready`. Evidence and review failures can only lower
333
397
  it. None of these states predicts or guarantees editorial acceptance.
334
398
 
399
+ Before external handoff or archival, export and independently verify a portable
400
+ audit directory. It contains the selected project, portable copies of admitted
401
+ inputs, formal evidence and artifact bytes, Policy/design/review objects,
402
+ outputs, environment fingerprints, and journal proofs. Credentials, setup
403
+ sources, browser profiles, native active state, capsules, unrelated projects,
404
+ and host-specific absolute paths are excluded.
405
+
406
+ ```bash
407
+ tiangong-ai research project audit export top-journal-paper \
408
+ --output /absolute/path/to/new-audit-directory \
409
+ --workspace /absolute/path/to/workspace --json
410
+ tiangong-ai research project audit verify \
411
+ --bundle /absolute/path/to/new-audit-directory --json
412
+ ```
413
+
335
414
  `research setup status --json` reports credential persistence separately from
336
415
  readiness. It also reports the effective exact-npx CLI package/version/root,
337
416
  the selected project orchestrator, any temporary recovery shim, ignored global
@@ -469,6 +548,42 @@ names its registered parent and inherits that parent's canonical source URL;
469
548
  it does not invent a second network-download binding, and a conflicting URL is
470
549
  rejected.
471
550
 
551
+ For top-journal work, the frozen scientific design maps every required evidence
552
+ role to all applicable lawful acquisition routes in the configured environment.
553
+ Every declared agent route for a required role is mandatory, and every required
554
+ capability must map to an available locked broker route at preflight.
555
+ Each broker call carries its exact `acquisition_route_id`; native activity and
556
+ download records carry `acquisitionRouteId`. A missing or mismatched route ID is
557
+ rejected rather than becoming evidence that a method was tried.
558
+
559
+ Inspect the live, hash-verified route state before declaring a material evidence
560
+ ceiling:
561
+
562
+ ```bash
563
+ tiangong-ai research project access status gpu-resource-impact \
564
+ --workspace /absolute/path/to/workspace --json
565
+ ```
566
+
567
+ Once all agent routes are terminal, the command first recommends assessing
568
+ required evidence-role coverage. Its `ifEvidenceStillInsufficient` field is a
569
+ conditional access/scope action, not a claim that purchase is always necessary.
570
+
571
+ Successful broker/native/download completion, explicit broker authentication or
572
+ entitlement denial, and validated deterministic no-OA download outcomes can be
573
+ terminal. HTTP 422, malformed requests, configuration errors, timeouts, 429,
574
+ 5xx, cancelled downloads, and login/MFA/CAPTCHA/security challenges are not
575
+ route exhaustion. Challenges pause immediately through an
576
+ `interactive-challenge` handoff.
577
+
578
+ Only after every required plan-bound agent route for a still-missing required
579
+ evidence role has exact terminal event hashes may the native host submit a
580
+ schema-v2 `evidence-exhausted` handoff. The durable handoff names each remaining
581
+ purchase, subscription, institutional authorization, owner input, external data
582
+ request, or field collection action with an official non-sensitive locator and
583
+ resume criteria. Research then stops; it does not spend more budget on
584
+ low-yield substitutes. If no lawful remaining route exists, the user must narrow
585
+ or abandon the unsupported scope before a new reviewed generation can resume.
586
+
472
587
  Successful acquisition freezes an immutable evidence snapshot before analysis.
473
588
  The reviewer and mechanical closure bind and recheck the snapshot chain,
474
589
  ledger, receipts, selected artifacts, excerpts, analysis, and report. Refresh a
@@ -527,12 +642,15 @@ repair with no research tools.
527
642
  Total, per-package, output, repair, broker-response bytes, estimated broker
528
643
  context tokens, context items, wall-time, output-count, output-size, and attempt
529
644
  limits live in `.tiangong-research/config.json`.
530
- New production workspaces use generous but finite runaway ceilings: 20,000,000
531
- total tokens and package ceilings of 12,000,000 for discovery, 2,000,000 for
645
+ New production workspaces use generous but finite runaway ceilings: 50,000,000
646
+ total tokens, USD 5,000, 30 days, and package ceilings of 12,000,000 for discovery, 2,000,000 for
532
647
  acquisition, 1,500,000 each for analysis and synthesis, and 2,500,000 for
533
648
  review. Primary output is bounded at 32,000 tokens and a separately invoked
534
649
  repair at 16,000. The production broker hard ceiling is 256 bounded views with
535
650
  32,000 context tokens per view; input context is bounded at 128,000 tokens.
651
+ Top-journal admission additionally reserves three early scientific reviews at
652
+ 500,000 tokens each, four final publication reviews at 750,000 each, and one
653
+ 4,000,000-token revision cycle, including their finite wall-time allowances.
536
654
  These values are not a target spend. Coverage-derived working plans and early
537
655
  stop control ordinary use, while the finite ceilings, three attempts per
538
656
  package, and explicit confirmation above the cost threshold stop runaway work.