@tiangong-ai/cli 0.0.22 → 0.0.24
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/AGENTS.md +3 -2
- package/README.md +114 -13
- package/dist/cli.js +15 -3
- package/dist/cli.js.map +1 -1
- package/dist/io.d.ts +3 -0
- package/dist/io.js.map +1 -1
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -1
- package/dist/research/orchestration.js +124 -4
- package/dist/research/orchestration.js.map +1 -1
- package/dist/research/setup-command.d.ts +3 -0
- package/dist/research/setup-command.js +487 -0
- package/dist/research/setup-command.js.map +1 -0
- package/dist/research/workspace/broker.js +77 -50
- package/dist/research/workspace/broker.js.map +1 -1
- package/dist/research/workspace/capabilities.d.ts +2 -0
- package/dist/research/workspace/capabilities.js +310 -7
- package/dist/research/workspace/capabilities.js.map +1 -1
- package/dist/research/workspace/constants.d.ts +3 -2
- package/dist/research/workspace/constants.js +25 -0
- package/dist/research/workspace/constants.js.map +1 -1
- package/dist/research/workspace/context.js +26 -1
- package/dist/research/workspace/context.js.map +1 -1
- package/dist/research/workspace/credentials.d.ts +19 -0
- package/dist/research/workspace/credentials.js +111 -0
- package/dist/research/workspace/credentials.js.map +1 -0
- package/dist/research/workspace/executor.d.ts +1 -0
- package/dist/research/workspace/executor.js +7 -3
- package/dist/research/workspace/executor.js.map +1 -1
- package/dist/research/workspace/external-skills.d.ts +477 -0
- package/dist/research/workspace/external-skills.js +1141 -0
- package/dist/research/workspace/external-skills.js.map +1 -0
- package/dist/research/workspace/preflight.d.ts +2 -0
- package/dist/research/workspace/preflight.js +11 -4
- package/dist/research/workspace/preflight.js.map +1 -1
- package/dist/research/workspace/runtime.js +63 -20
- package/dist/research/workspace/runtime.js.map +1 -1
- package/dist/research/workspace/setup-catalog.d.ts +161 -0
- package/dist/research/workspace/setup-catalog.js +601 -0
- package/dist/research/workspace/setup-catalog.js.map +1 -0
- package/dist/research/workspace/setup-wizard.d.ts +24 -0
- package/dist/research/workspace/setup-wizard.js +465 -0
- package/dist/research/workspace/setup-wizard.js.map +1 -0
- package/dist/research/workspace/setup.d.ts +463 -0
- package/dist/research/workspace/setup.js +3000 -0
- package/dist/research/workspace/setup.js.map +1 -0
- package/dist/research/workspace/storage.js +44 -2
- package/dist/research/workspace/storage.js.map +1 -1
- package/dist/research/workspace/types.d.ts +42 -1
- package/dist/research/workspace/workspace.d.ts +2 -0
- package/dist/research/workspace/workspace.js +154 -52
- package/dist/research/workspace/workspace.js.map +1 -1
- package/package.json +4 -4
package/AGENTS.md
CHANGED
|
@@ -15,8 +15,8 @@ checkPaths:
|
|
|
15
15
|
- .docpact/config.yaml
|
|
16
16
|
- docs/agents/**
|
|
17
17
|
- src/**
|
|
18
|
-
lastReviewedAt: 2026-08-
|
|
19
|
-
lastReviewedCommit:
|
|
18
|
+
lastReviewedAt: 2026-08-08
|
|
19
|
+
lastReviewedCommit: c55eab450de73bed783c7417c43db20ef56c0c43
|
|
20
20
|
---
|
|
21
21
|
|
|
22
22
|
# Tiangong AI CLI Contract
|
|
@@ -46,6 +46,7 @@ This repository owns the Tiangong AI command-line interface.
|
|
|
46
46
|
- `tiangong-ai kb collections`
|
|
47
47
|
- `tiangong-ai kb status`
|
|
48
48
|
- `tiangong-ai research context`
|
|
49
|
+
- `tiangong-ai research setup`
|
|
49
50
|
- `tiangong-ai research workspace`
|
|
50
51
|
- `tiangong-ai research capability`
|
|
51
52
|
- `tiangong-ai research project`
|
package/README.md
CHANGED
|
@@ -12,8 +12,8 @@ checkPaths:
|
|
|
12
12
|
- package.json
|
|
13
13
|
- bin/**
|
|
14
14
|
- src/**
|
|
15
|
-
lastReviewedAt: 2026-08-
|
|
16
|
-
lastReviewedCommit:
|
|
15
|
+
lastReviewedAt: 2026-08-08
|
|
16
|
+
lastReviewedCommit: 2aee8339c04d94dc42a8b34d20d59af27dbe756d
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
# Tiangong AI CLI
|
|
@@ -201,8 +201,14 @@ file, and budget confirmation when `maxCostUsd` exceeds
|
|
|
201
201
|
`confirmationCostUsd`:
|
|
202
202
|
|
|
203
203
|
```bash
|
|
204
|
-
tiangong-ai research
|
|
205
|
-
--
|
|
204
|
+
tiangong-ai research setup catalog \
|
|
205
|
+
--workspace /absolute/path/to/workspace --json
|
|
206
|
+
# Interactive and user-initiated: select external Skills, credential variable
|
|
207
|
+
# names, licenses, install scope, and checks.
|
|
208
|
+
tiangong-ai research setup \
|
|
209
|
+
--workspace /absolute/path/to/workspace --json
|
|
210
|
+
tiangong-ai research setup status \
|
|
211
|
+
--workspace /absolute/path/to/workspace --json
|
|
206
212
|
tiangong-ai research project preflight \
|
|
207
213
|
--workspace /absolute/path/to/workspace \
|
|
208
214
|
--question "How do advanced GPU process nodes change environmental resource burdens?" \
|
|
@@ -214,6 +220,40 @@ tiangong-ai research project init gpu-resource-impact \
|
|
|
214
220
|
--confirm-budget --json
|
|
215
221
|
```
|
|
216
222
|
|
|
223
|
+
The guided setup creates an immutable, hash-bound plan before mutation. No Skill
|
|
224
|
+
is bundled or installed implicitly. It pins the installer integrity, source
|
|
225
|
+
commits, Skill tree hashes, exact destinations, license acceptance, credential
|
|
226
|
+
environment names, settings, and checks. Required credential preflight runs
|
|
227
|
+
before downloads. Project-local copy is the default; global writes, network
|
|
228
|
+
downloads, live provider checks, synthetic document uploads, and paid agent
|
|
229
|
+
smokes each require their applicable confirmation.
|
|
230
|
+
|
|
231
|
+
Production admission requires at least one locked external capability with
|
|
232
|
+
`brokered-network` and `discoveryScopes: ["public-internet"]`; an input plan or
|
|
233
|
+
local files alone cannot represent internet coverage. The machine-readable
|
|
234
|
+
setup catalog contains only separately sourced external Skills and reports each
|
|
235
|
+
evidence, preprocessing, acquisition, and post-closure recommendation; exact
|
|
236
|
+
source commit and tree hash; license and credential requirements; dependencies;
|
|
237
|
+
and installed-byte status. Installation is never performed by a research
|
|
238
|
+
package.
|
|
239
|
+
|
|
240
|
+
The default `internet-research` profile selects Brave Web Search and News
|
|
241
|
+
Search. `internet-research-with-context` additionally selects the
|
|
242
|
+
subscription-dependent LLM Context endpoint, while
|
|
243
|
+
`internet-research-with-media` also selects image and video discovery. A
|
|
244
|
+
provider-plan or authentication failure blocks the selected profile instead of
|
|
245
|
+
silently dropping a Skill. `credential set` reads the value only from the
|
|
246
|
+
explicit owner environment name and stores it under the declared logical ID;
|
|
247
|
+
the value is never returned or journaled.
|
|
248
|
+
|
|
249
|
+
Optional setup entries have explicit roles. Tiangong SCI is an
|
|
250
|
+
owner-whitelisted POST evidence capability; document decomposition is an input
|
|
251
|
+
preprocessor; academic paper download is an acquisition adapter; document and
|
|
252
|
+
presentation Skills are post-closure authoring only. Run selected preprocessors
|
|
253
|
+
and acquisition adapters with `research setup companion run`, then admit their
|
|
254
|
+
exact hash-bound output separately. Automatic paper OA exhaustion returns an
|
|
255
|
+
explicit browser handoff and never launches or chooses a browser silently.
|
|
256
|
+
|
|
217
257
|
The requirements object declares `dimensions`, `sourceTypes`, `minSources`,
|
|
218
258
|
`minFullTextSources`, `minDatedSources`, and optional inclusive
|
|
219
259
|
`publicationDateFrom` / `publicationDateTo` boundaries (`YYYY-MM-DD` or
|
|
@@ -234,7 +274,11 @@ routes use the same agent family.
|
|
|
234
274
|
|
|
235
275
|
Research execution requires `/usr/bin/sandbox-exec` on macOS or Bubblewrap
|
|
236
276
|
(`bwrap`) on Linux. Windows can inspect and configure workspaces but does not
|
|
237
|
-
execute research packages.
|
|
277
|
+
execute research packages. That outer platform sandbox is the execution
|
|
278
|
+
boundary. Codex is therefore started with its nested sandbox disabled: nesting
|
|
279
|
+
Seatbelt on macOS can cancel MCP calls even though the process is already
|
|
280
|
+
confined. Shell and unified-exec tools remain disabled, as do undeclared Codex
|
|
281
|
+
integrations.
|
|
238
282
|
|
|
239
283
|
Add immutable local evidence, verify the workspace, and execute ready work:
|
|
240
284
|
|
|
@@ -245,7 +289,7 @@ tiangong-ai research project input add gpu-resource-impact \
|
|
|
245
289
|
--role primary
|
|
246
290
|
tiangong-ai research workspace doctor --workspace /absolute/path/to/workspace
|
|
247
291
|
tiangong-ai research workspace doctor --workspace /absolute/path/to/workspace \
|
|
248
|
-
--agent-smoke
|
|
292
|
+
--agent-smoke --capability-smoke
|
|
249
293
|
tiangong-ai research run --workspace /absolute/path/to/workspace \
|
|
250
294
|
--project gpu-resource-impact --progress-jsonl
|
|
251
295
|
tiangong-ai research status --workspace /absolute/path/to/workspace --json
|
|
@@ -287,9 +331,15 @@ facts.
|
|
|
287
331
|
Total, per-package, output, repair, broker-response bytes, estimated broker
|
|
288
332
|
context tokens, context items, wall-time, output-count, output-size, and attempt
|
|
289
333
|
limits live in `.tiangong-research/config.json`.
|
|
334
|
+
New workspaces reserve 500,000 total tokens by default, including 200,000 for
|
|
335
|
+
discovery; the remaining package defaults are 55,000 for analysis, 60,000 for
|
|
336
|
+
synthesis, and 120,000 for review. These are admission ceilings rather than a
|
|
337
|
+
target spend and can be lowered only when the resulting pre-call reservations
|
|
338
|
+
still fit.
|
|
290
339
|
Before an agent starts, the runtime reserves the package token and conservative
|
|
291
340
|
price budget. The call-level check accounts for prompt and schema bytes at
|
|
292
341
|
three bytes per token, repeats input allowance for every permitted API turn,
|
|
342
|
+
adds the maximum bounded broker context for every permitted discovery turn,
|
|
293
343
|
and adds primary output plus a potential isolated repair's input and output;
|
|
294
344
|
insufficient package or remaining project budget prevents invocation. The
|
|
295
345
|
provider cost cap is the current package reservation, not the remaining
|
|
@@ -300,7 +350,9 @@ schema tool, uses one plain-JSON turn, and remains subject to the CLI schema and
|
|
|
300
350
|
semantic validators. Current Codex and Claude CLI adapters report
|
|
301
351
|
output usage only after execution, so preflight identifies
|
|
302
352
|
`outputTokenLimitEnforcement` as `post-execution`; captured bytes provide a
|
|
303
|
-
separate process bound
|
|
353
|
+
separate process bound. Discovery capture allowance includes the bounded MCP
|
|
354
|
+
tool contexts as well as the requested model output, and over-limit output fails
|
|
355
|
+
without promotion.
|
|
304
356
|
Preflight also reports per-stage `maxTurns` and `turnLimitEnforcement`: Claude
|
|
305
357
|
receives a provider-side turn cap, while the current Codex CLI exposes no such
|
|
306
358
|
flag, so its turn allowance is reservation guidance plus post-execution
|
|
@@ -323,7 +375,12 @@ context, broker objects, and registered local input hashes before recording
|
|
|
323
375
|
their safe locators. Capsule deletion therefore does not delete the durable
|
|
324
376
|
review chain.
|
|
325
377
|
|
|
326
|
-
Discovery
|
|
378
|
+
Discovery receives only the capability broker as an execution tool. The CLI
|
|
379
|
+
embeds the exact staged capability manifest and each external Skill's top-level
|
|
380
|
+
`SKILL.md` in the prompt, so the producer does not need filesystem or shell
|
|
381
|
+
access and cannot execute provider examples directly. Broker responses include
|
|
382
|
+
the exact bounded context inline with the hash-bound receipt; raw objects remain
|
|
383
|
+
in the permanent evidence store for audit.
|
|
327
384
|
Analyze and synthesize receive bounded, hash-verified prior-stage artifacts in
|
|
328
385
|
their prompt with tools disabled. Review is also tool-free and limited to the
|
|
329
386
|
two turns required by the structured-output protocol:
|
|
@@ -337,8 +394,31 @@ dimension is usable but incomplete; a missing dimension or unmet declared
|
|
|
337
394
|
minimum blocks downstream work. Qualitative gaps remain visible without
|
|
338
395
|
silently changing those mechanical fields.
|
|
339
396
|
|
|
340
|
-
Method
|
|
341
|
-
|
|
397
|
+
Method Skills are external to this project. Recommended Skills are selected
|
|
398
|
+
through `research setup`; a custom owner-selected database, domain index, or
|
|
399
|
+
other external method is admitted from an absolute reviewed definition:
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
tiangong-ai research capability import \
|
|
403
|
+
--definition /absolute/path/to/external-capability.json \
|
|
404
|
+
--workspace /absolute/path/to/workspace --json
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
`research capability catalog --json` returns the authoritative custom
|
|
408
|
+
definition template. Its source must identify an external git, registry, or
|
|
409
|
+
local artifact with an immutable reference, explicit `expectedTreeSha256`, and
|
|
410
|
+
license. Git references must be full 40-character commits; registry references
|
|
411
|
+
must be exact versions; local references must equal
|
|
412
|
+
`sha256:<expectedTreeSha256>`. Every source type must match the installed whole
|
|
413
|
+
tree before a lock can be written. Skill trees reject symlinks and excessive
|
|
414
|
+
file counts/sizes. Project-owned Tiangong Skills are rejected through this
|
|
415
|
+
generic import path; the setup catalog has a separate reviewed first-party
|
|
416
|
+
adapter for Tiangong SCI. Configure/import refuses to rewrite the lock if any
|
|
417
|
+
existing capability has drifted; restore it or explicitly update its source
|
|
418
|
+
identity and expected hash first.
|
|
419
|
+
|
|
420
|
+
External Skills use absolute paths and explicit permissions, then freeze
|
|
421
|
+
before execution:
|
|
342
422
|
|
|
343
423
|
```bash
|
|
344
424
|
tiangong-ai research capability lock --workspace /absolute/path/to/workspace
|
|
@@ -346,10 +426,19 @@ tiangong-ai research capability verify --workspace /absolute/path/to/workspace
|
|
|
346
426
|
```
|
|
347
427
|
|
|
348
428
|
A capability using `brokered-network` must declare exact `allowedHosts` and may
|
|
349
|
-
declare an `http` policy with
|
|
429
|
+
declare an `http` policy with `method` (`GET` or bounded JSON `POST`), one exact
|
|
430
|
+
`accept` value, safe `staticHeaders`, `maxRequestBytes`,
|
|
350
431
|
`allowedContentTypes`, `maxResponseBytes`, and `maxItems`. Its optional
|
|
351
432
|
`coverage` block declares dimensions, source types, full-text availability,
|
|
352
|
-
|
|
433
|
+
publication-date availability, and named discovery scopes for the preflight gap
|
|
434
|
+
report. Mark `requiredForDiscovery: true` for every public index or
|
|
435
|
+
owner-whitelisted database the question must exercise. Downstream work is
|
|
436
|
+
blocked unless each such capability produces its own verified broker receipt;
|
|
437
|
+
another local file cannot substitute for it. POST request bodies may contain
|
|
438
|
+
only documented non-secret fields; credential-like keys are rejected, only the
|
|
439
|
+
body hash is persisted, and redirects are refused. A non-network external
|
|
440
|
+
method-guidance Skill stages reviewed instructions but does not grant an
|
|
441
|
+
undeclared tool or service call.
|
|
353
442
|
Optional credentials declare logical IDs, exact host scopes, header names, and
|
|
354
443
|
prefixes. Put only the logical value map in `.tiangong-research/.env`:
|
|
355
444
|
|
|
@@ -357,9 +446,21 @@ prefixes. Put only the logical value map in `.tiangong-research/.env`:
|
|
|
357
446
|
TIANGONG_RESEARCH_CAPABILITY_CREDENTIALS_JSON={"source.example.api":"owner-provided-value"}
|
|
358
447
|
```
|
|
359
448
|
|
|
449
|
+
Prefer the non-echoing configuration command over hand editing:
|
|
450
|
+
|
|
451
|
+
```bash
|
|
452
|
+
tiangong-ai research capability credential set \
|
|
453
|
+
--id source.example.api --from-env OWNER_DATABASE_API_KEY \
|
|
454
|
+
--workspace /absolute/path/to/workspace --json
|
|
455
|
+
```
|
|
456
|
+
|
|
360
457
|
The broker injects declared credentials only for admitted HTTPS hosts. Agent
|
|
361
458
|
processes do not receive this variable. Keep the file owner-only (`chmod 600`)
|
|
362
|
-
and
|
|
459
|
+
and run `research capability doctor --live` plus production
|
|
460
|
+
`research workspace doctor --agent-smoke --capability-smoke` before a run.
|
|
461
|
+
Capability doctor retries only one 429 response with bounded `Retry-After`
|
|
462
|
+
backoff; deterministic 4xx, missing subscription, authentication, drift, and
|
|
463
|
+
content-type failures stop explicitly. The broker preserves a
|
|
363
464
|
sanitized non-2xx excerpt, safe request ID, and `Retry-After`; it supports JSON
|
|
364
465
|
Pointer extraction, bounded item and estimated-token views, and an explicit
|
|
365
466
|
public-response cache. For a JSON collection, use the returned
|
package/dist/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ import packageMetadata from "../package.json" with { type: "json" };
|
|
|
10
10
|
import { getBoolean, getNonNegativeInteger, getPositiveInteger, getString, nonNegativeIntegerValue, parseArgs, positiveIntegerValue, positiveNumberValue, } from "./args.js";
|
|
11
11
|
import { isObject, responseData, stringField } from "./data.js";
|
|
12
12
|
import { firstEnv, loadDotenv } from "./env.js";
|
|
13
|
-
import { CliError, HttpError } from "./errors.js";
|
|
13
|
+
import { CliError, HttpError, toErrorPayload } from "./errors.js";
|
|
14
14
|
import { jsonRequest } from "./http.js";
|
|
15
15
|
import { runEducationCommand } from "./education/commands.js";
|
|
16
16
|
import { collectionKey, collectionPath, listCollections, resolveCollection, resolveSelectorFields, } from "./kb/client.js";
|
|
@@ -19,8 +19,9 @@ import { runCourseFulltextCommand } from "./kb/course-fulltext.js";
|
|
|
19
19
|
import { readBulkPipelineHealth } from "./kb/pipeline-health.js";
|
|
20
20
|
import { resolveCollectionSelector } from "./kb/selector.js";
|
|
21
21
|
import { batchDocumentStatuses, getDocumentStatus } from "./kb/status.js";
|
|
22
|
-
import { write } from "./io.js";
|
|
22
|
+
import { stringifyJson, write } from "./io.js";
|
|
23
23
|
import { runResearchCommand } from "./research/commands.js";
|
|
24
|
+
import { configuredResearchSecrets, sanitizeResearchText, sanitizeResearchValue, } from "./research/workspace/sanitization.js";
|
|
24
25
|
export { parseArgs } from "./args.js";
|
|
25
26
|
export { DEFAULT_API_BASE_URL, DEFAULT_API_PATH_PREFIX } from "./kb/config.js";
|
|
26
27
|
export { resolveCollectionSelector } from "./kb/selector.js";
|
|
@@ -138,7 +139,18 @@ export async function runCli(argv, io) {
|
|
|
138
139
|
}
|
|
139
140
|
catch (error) {
|
|
140
141
|
if (error instanceof CliError) {
|
|
141
|
-
|
|
142
|
+
if (argv[0] === "research") {
|
|
143
|
+
const secrets = configuredResearchSecrets(io.env);
|
|
144
|
+
if (argv.includes("--json")) {
|
|
145
|
+
write(io.stderr, stringifyJson(sanitizeResearchValue(toErrorPayload(error), secrets), true));
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
write(io.stderr, `${sanitizeResearchText(error.message, secrets)}\n`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
write(io.stderr, `${error.message}\n`);
|
|
153
|
+
}
|
|
142
154
|
return error.exitCode;
|
|
143
155
|
}
|
|
144
156
|
throw error;
|