@tiangong-ai/cli 0.0.34 → 0.0.36

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 (49) hide show
  1. package/AGENTS.md +18 -6
  2. package/README.md +147 -2
  3. package/dist/research/orchestration.js +651 -24
  4. package/dist/research/orchestration.js.map +1 -1
  5. package/dist/research/workspace/audit-bundle.d.ts +44 -0
  6. package/dist/research/workspace/audit-bundle.js +357 -0
  7. package/dist/research/workspace/audit-bundle.js.map +1 -0
  8. package/dist/research/workspace/input-plan.js +27 -1
  9. package/dist/research/workspace/input-plan.js.map +1 -1
  10. package/dist/research/workspace/preflight.d.ts +34 -2
  11. package/dist/research/workspace/preflight.js +145 -1
  12. package/dist/research/workspace/preflight.js.map +1 -1
  13. package/dist/research/workspace/projects.d.ts +32 -5
  14. package/dist/research/workspace/projects.js +263 -7
  15. package/dist/research/workspace/projects.js.map +1 -1
  16. package/dist/research/workspace/publication-workflow.d.ts +146 -0
  17. package/dist/research/workspace/publication-workflow.js +994 -0
  18. package/dist/research/workspace/publication-workflow.js.map +1 -0
  19. package/dist/research/workspace/publication.d.ts +110 -0
  20. package/dist/research/workspace/publication.js +246 -0
  21. package/dist/research/workspace/publication.js.map +1 -0
  22. package/dist/research/workspace/research-policy-wizard.d.ts +40 -0
  23. package/dist/research/workspace/research-policy-wizard.js +167 -0
  24. package/dist/research/workspace/research-policy-wizard.js.map +1 -0
  25. package/dist/research/workspace/research-policy.d.ts +70 -0
  26. package/dist/research/workspace/research-policy.js +886 -0
  27. package/dist/research/workspace/research-policy.js.map +1 -0
  28. package/dist/research/workspace/runtime.d.ts +17 -0
  29. package/dist/research/workspace/runtime.js +84 -2
  30. package/dist/research/workspace/runtime.js.map +1 -1
  31. package/dist/research/workspace/sanitization.js +9 -3
  32. package/dist/research/workspace/sanitization.js.map +1 -1
  33. package/dist/research/workspace/scientific-design.d.ts +336 -0
  34. package/dist/research/workspace/scientific-design.js +1845 -0
  35. package/dist/research/workspace/scientific-design.js.map +1 -0
  36. package/dist/research/workspace/scientific-review.d.ts +101 -0
  37. package/dist/research/workspace/scientific-review.js +1167 -0
  38. package/dist/research/workspace/scientific-review.js.map +1 -0
  39. package/dist/research/workspace/setup-catalog.js +2 -2
  40. package/dist/research/workspace/setup-wizard.d.ts +18 -1
  41. package/dist/research/workspace/setup-wizard.js +1 -1
  42. package/dist/research/workspace/setup-wizard.js.map +1 -1
  43. package/dist/research/workspace/setup.d.ts +1 -0
  44. package/dist/research/workspace/setup.js +64 -0
  45. package/dist/research/workspace/setup.js.map +1 -1
  46. package/dist/research/workspace/types.d.ts +58 -0
  47. package/dist/research/workspace/workspace.js +25 -7
  48. package/dist/research/workspace/workspace.js.map +1 -1
  49. package/package.json +4 -2
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-12
19
- lastReviewedCommit: 7d692de934c51178df520ccdaa212acc7dc303f0
20
+ lastReviewedAt: 2026-08-15
21
+ lastReviewedCommit: df263405bccb21cd5838d92d82dccf80ca01acb1
20
22
  ---
21
23
 
22
24
  # Tiangong AI CLI Contract
@@ -47,6 +49,8 @@ This repository owns the Tiangong AI command-line interface.
47
49
  - `tiangong-ai kb status`
48
50
  - `tiangong-ai research context`
49
51
  - `tiangong-ai research setup`
52
+ - `tiangong-ai research policy`
53
+ - `tiangong-ai research publication`
50
54
  - `tiangong-ai research workspace`
51
55
  - `tiangong-ai research capability`
52
56
  - `tiangong-ai research project`
@@ -60,7 +64,7 @@ This repository owns the Tiangong AI command-line interface.
60
64
  Run before delivery:
61
65
 
62
66
  ```bash
63
- npm run test:clean
67
+ npm run test:clean:cold
64
68
  npm run lint
65
69
  npm run build
66
70
  npm test
@@ -69,9 +73,17 @@ docpact validate-config --root . --strict
69
73
  docpact lint --root . --worktree --mode enforce
70
74
  ```
71
75
 
72
- For Auto Research changes, `npm run test:clean` is the authoritative TDD gate.
73
- Write the regression first, observe it fail in that clean container, then make
74
- 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.
75
87
 
76
88
  Use `npm run typecheck` for a faster TypeScript-only check.
77
89
  Use `npm run prepush:gate` when `docpact` is installed and you want the
package/README.md CHANGED
@@ -269,6 +269,148 @@ 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 Policy, scientific design, and publication gates
273
+
274
+ A `top-journal` project starts with a human-reviewed Markdown Policy, not with
275
+ model execution. After project-scoped setup reaches `READY`, use the guided
276
+ Wizard:
277
+
278
+ ```bash
279
+ tiangong-ai research policy wizard top-journal-paper \
280
+ --workspace /absolute/path/to/workspace
281
+ tiangong-ai research policy status top-journal-paper \
282
+ --workspace /absolute/path/to/workspace --json
283
+ ```
284
+
285
+ The Wizard resolves only the verified project-installed
286
+ `tiangong-auto-research` tree. It copies a baseline plus one article type,
287
+ field, journal class, project brief, and four reviewer rubrics. Generic defaults
288
+ are clearly reported and require a separate acknowledgement. An exact-journal
289
+ Policy additionally requires a current official HTTPS guideline URL, retrieval
290
+ date, and substantive human content for all journal-specific sections. Approval
291
+ binds the manifest and every document by SHA-256; edits, manifest tampering, or
292
+ expiry block preflight and all later stages until the Policy is reviewed and
293
+ approved again.
294
+
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:
316
+
317
+ ```bash
318
+ tiangong-ai research schema show scientific-design --json
319
+ tiangong-ai research project preflight \
320
+ --question "A specific, testable research question" \
321
+ --goal top-journal --policy-project top-journal-paper \
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 \
333
+ --workspace /absolute/path/to/workspace --json
334
+ ```
335
+
336
+ The base evidence lifecycle remains
337
+ `discover -> acquire -> analyze -> synthesize -> review -> close`, authored in
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.
375
+ Exactly four fresh independent sessions review that frozen generation:
376
+ evidence, methods/reproducibility, domain/novelty, and journal-editor. A revised
377
+ manuscript invalidates prior reviews; reviewer-session reuse is rejected from
378
+ the append-only journal even if mutable cache state is removed. The raw opaque
379
+ producer/reviewer session identifiers are accepted only at the command boundary;
380
+ generation, packet, review, journal, and closure objects persist only their
381
+ SHA-256 bindings.
382
+
383
+ ```bash
384
+ tiangong-ai research schema show publication-assessment --json
385
+ tiangong-ai research publication freeze top-journal-paper \
386
+ --manuscript /absolute/path/to/final-manuscript.md \
387
+ --assessment /absolute/path/to/publication-assessment.json \
388
+ --producer-agent codex --producer-session OPAQUE_NATIVE_SESSION \
389
+ --workspace /absolute/path/to/workspace --json
390
+ tiangong-ai research publication status top-journal-paper \
391
+ --workspace /absolute/path/to/workspace --json
392
+ ```
393
+
394
+ The CLI returns a mechanically bounded ceiling:
395
+ `top-journal-candidate`, `top-journal-class-ready`, or
396
+ `target-journal-submission-ready`. Evidence and review failures can only lower
397
+ it. None of these states predicts or guarantees editorial acceptance.
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
+
272
414
  `research setup status --json` reports credential persistence separately from
273
415
  readiness. It also reports the effective exact-npx CLI package/version/root,
274
416
  the selected project orchestrator, any temporary recovery shim, ignored global
@@ -464,12 +606,15 @@ repair with no research tools.
464
606
  Total, per-package, output, repair, broker-response bytes, estimated broker
465
607
  context tokens, context items, wall-time, output-count, output-size, and attempt
466
608
  limits live in `.tiangong-research/config.json`.
467
- New production workspaces use generous but finite runaway ceilings: 20,000,000
468
- total tokens and package ceilings of 12,000,000 for discovery, 2,000,000 for
609
+ New production workspaces use generous but finite runaway ceilings: 50,000,000
610
+ total tokens, USD 5,000, 30 days, and package ceilings of 12,000,000 for discovery, 2,000,000 for
469
611
  acquisition, 1,500,000 each for analysis and synthesis, and 2,500,000 for
470
612
  review. Primary output is bounded at 32,000 tokens and a separately invoked
471
613
  repair at 16,000. The production broker hard ceiling is 256 bounded views with
472
614
  32,000 context tokens per view; input context is bounded at 128,000 tokens.
615
+ Top-journal admission additionally reserves three early scientific reviews at
616
+ 500,000 tokens each, four final publication reviews at 750,000 each, and one
617
+ 4,000,000-token revision cycle, including their finite wall-time allowances.
473
618
  These values are not a target spend. Coverage-derived working plans and early
474
619
  stop control ordinary use, while the finite ceilings, three attempts per
475
620
  package, and explicit confirmation above the cost threshold stop runaway work.