@tiangong-ai/cli 0.0.22 → 0.0.23
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 +2 -2
- package/README.md +101 -9
- package/dist/cli.js +15 -3
- package/dist/cli.js.map +1 -1
- package/dist/research/orchestration.js +117 -4
- package/dist/research/orchestration.js.map +1 -1
- package/dist/research/workspace/broker.js +38 -46
- package/dist/research/workspace/broker.js.map +1 -1
- package/dist/research/workspace/capabilities.d.ts +2 -0
- package/dist/research/workspace/capabilities.js +246 -7
- package/dist/research/workspace/capabilities.js.map +1 -1
- package/dist/research/workspace/constants.d.ts +2 -2
- package/dist/research/workspace/constants.js +6 -0
- package/dist/research/workspace/constants.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 +458 -0
- package/dist/research/workspace/external-skills.js +1000 -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/storage.js +37 -2
- package/dist/research/workspace/storage.js.map +1 -1
- package/dist/research/workspace/types.d.ts +29 -0
- package/dist/research/workspace/workspace.d.ts +2 -0
- package/dist/research/workspace/workspace.js +98 -45
- 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
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ checkPaths:
|
|
|
13
13
|
- bin/**
|
|
14
14
|
- src/**
|
|
15
15
|
lastReviewedAt: 2026-08-07
|
|
16
|
-
lastReviewedCommit:
|
|
16
|
+
lastReviewedCommit: 5d942d487a7c4592de80e0ac64ac6741c6836942
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
# Tiangong AI CLI
|
|
@@ -203,6 +203,18 @@ file, and budget confirmation when `maxCostUsd` exceeds
|
|
|
203
203
|
```bash
|
|
204
204
|
tiangong-ai research workspace init /absolute/path/to/workspace \
|
|
205
205
|
--mode production-research
|
|
206
|
+
tiangong-ai research capability catalog \
|
|
207
|
+
--path /absolute/path/to/workspace \
|
|
208
|
+
--workspace /absolute/path/to/workspace --json
|
|
209
|
+
# Run the returned pinned project installation plan outside the research runtime.
|
|
210
|
+
tiangong-ai research capability configure \
|
|
211
|
+
--profile internet-research \
|
|
212
|
+
--workspace /absolute/path/to/workspace --json
|
|
213
|
+
tiangong-ai research capability credential set \
|
|
214
|
+
--id brave.search.api-key --from-env BRAVE_SEARCH_API_KEY \
|
|
215
|
+
--workspace /absolute/path/to/workspace --json
|
|
216
|
+
tiangong-ai research capability doctor --live \
|
|
217
|
+
--workspace /absolute/path/to/workspace --json
|
|
206
218
|
tiangong-ai research project preflight \
|
|
207
219
|
--workspace /absolute/path/to/workspace \
|
|
208
220
|
--question "How do advanced GPU process nodes change environmental resource burdens?" \
|
|
@@ -214,6 +226,27 @@ tiangong-ai research project init gpu-resource-impact \
|
|
|
214
226
|
--confirm-budget --json
|
|
215
227
|
```
|
|
216
228
|
|
|
229
|
+
Production admission requires at least one locked external capability with
|
|
230
|
+
`brokered-network` and `discoveryScopes: ["public-internet"]`; an input plan or
|
|
231
|
+
local files alone cannot represent internet coverage. The machine-readable
|
|
232
|
+
catalog contains only external Skills and reports every required, enhanced,
|
|
233
|
+
and conditional recommendation; exact source commit and whole-tree hash; a
|
|
234
|
+
pinned installer version and checkout/install plan; credential requirements;
|
|
235
|
+
and installed, configured, locked, and live provider status. Installation is
|
|
236
|
+
never performed by the research runtime. It also reports the other Skills
|
|
237
|
+
evaluated from the pinned upstream package and why each is not selected:
|
|
238
|
+
custom question-specific admission, query assistance without evidence, or an
|
|
239
|
+
execution model that the bounded GET broker does not authorize.
|
|
240
|
+
|
|
241
|
+
The default `internet-research` profile selects Brave Web Search and News
|
|
242
|
+
Search. `internet-research-with-context` additionally selects the
|
|
243
|
+
subscription-dependent LLM Context endpoint, while
|
|
244
|
+
`internet-research-with-media` also selects image and video discovery. A
|
|
245
|
+
provider-plan or authentication failure blocks the selected profile instead of
|
|
246
|
+
silently dropping a Skill. `credential set` reads the value only from the
|
|
247
|
+
explicit owner environment name and stores it under the declared logical ID;
|
|
248
|
+
the value is never returned or journaled.
|
|
249
|
+
|
|
217
250
|
The requirements object declares `dimensions`, `sourceTypes`, `minSources`,
|
|
218
251
|
`minFullTextSources`, `minDatedSources`, and optional inclusive
|
|
219
252
|
`publicationDateFrom` / `publicationDateTo` boundaries (`YYYY-MM-DD` or
|
|
@@ -234,7 +267,11 @@ routes use the same agent family.
|
|
|
234
267
|
|
|
235
268
|
Research execution requires `/usr/bin/sandbox-exec` on macOS or Bubblewrap
|
|
236
269
|
(`bwrap`) on Linux. Windows can inspect and configure workspaces but does not
|
|
237
|
-
execute research packages.
|
|
270
|
+
execute research packages. That outer platform sandbox is the execution
|
|
271
|
+
boundary. Codex is therefore started with its nested sandbox disabled: nesting
|
|
272
|
+
Seatbelt on macOS can cancel MCP calls even though the process is already
|
|
273
|
+
confined. Shell and unified-exec tools remain disabled, as do undeclared Codex
|
|
274
|
+
integrations.
|
|
238
275
|
|
|
239
276
|
Add immutable local evidence, verify the workspace, and execute ready work:
|
|
240
277
|
|
|
@@ -245,7 +282,7 @@ tiangong-ai research project input add gpu-resource-impact \
|
|
|
245
282
|
--role primary
|
|
246
283
|
tiangong-ai research workspace doctor --workspace /absolute/path/to/workspace
|
|
247
284
|
tiangong-ai research workspace doctor --workspace /absolute/path/to/workspace \
|
|
248
|
-
--agent-smoke
|
|
285
|
+
--agent-smoke --capability-smoke
|
|
249
286
|
tiangong-ai research run --workspace /absolute/path/to/workspace \
|
|
250
287
|
--project gpu-resource-impact --progress-jsonl
|
|
251
288
|
tiangong-ai research status --workspace /absolute/path/to/workspace --json
|
|
@@ -287,9 +324,15 @@ facts.
|
|
|
287
324
|
Total, per-package, output, repair, broker-response bytes, estimated broker
|
|
288
325
|
context tokens, context items, wall-time, output-count, output-size, and attempt
|
|
289
326
|
limits live in `.tiangong-research/config.json`.
|
|
327
|
+
New workspaces reserve 500,000 total tokens by default, including 200,000 for
|
|
328
|
+
discovery; the remaining package defaults are 55,000 for analysis, 60,000 for
|
|
329
|
+
synthesis, and 120,000 for review. These are admission ceilings rather than a
|
|
330
|
+
target spend and can be lowered only when the resulting pre-call reservations
|
|
331
|
+
still fit.
|
|
290
332
|
Before an agent starts, the runtime reserves the package token and conservative
|
|
291
333
|
price budget. The call-level check accounts for prompt and schema bytes at
|
|
292
334
|
three bytes per token, repeats input allowance for every permitted API turn,
|
|
335
|
+
adds the maximum bounded broker context for every permitted discovery turn,
|
|
293
336
|
and adds primary output plus a potential isolated repair's input and output;
|
|
294
337
|
insufficient package or remaining project budget prevents invocation. The
|
|
295
338
|
provider cost cap is the current package reservation, not the remaining
|
|
@@ -300,7 +343,9 @@ schema tool, uses one plain-JSON turn, and remains subject to the CLI schema and
|
|
|
300
343
|
semantic validators. Current Codex and Claude CLI adapters report
|
|
301
344
|
output usage only after execution, so preflight identifies
|
|
302
345
|
`outputTokenLimitEnforcement` as `post-execution`; captured bytes provide a
|
|
303
|
-
separate process bound
|
|
346
|
+
separate process bound. Discovery capture allowance includes the bounded MCP
|
|
347
|
+
tool contexts as well as the requested model output, and over-limit output fails
|
|
348
|
+
without promotion.
|
|
304
349
|
Preflight also reports per-stage `maxTurns` and `turnLimitEnforcement`: Claude
|
|
305
350
|
receives a provider-side turn cap, while the current Codex CLI exposes no such
|
|
306
351
|
flag, so its turn allowance is reservation guidance plus post-execution
|
|
@@ -323,7 +368,12 @@ context, broker objects, and registered local input hashes before recording
|
|
|
323
368
|
their safe locators. Capsule deletion therefore does not delete the durable
|
|
324
369
|
review chain.
|
|
325
370
|
|
|
326
|
-
Discovery
|
|
371
|
+
Discovery receives only the capability broker as an execution tool. The CLI
|
|
372
|
+
embeds the exact staged capability manifest and each external Skill's top-level
|
|
373
|
+
`SKILL.md` in the prompt, so the producer does not need filesystem or shell
|
|
374
|
+
access and cannot execute provider examples directly. Broker responses include
|
|
375
|
+
the exact bounded context inline with the hash-bound receipt; raw objects remain
|
|
376
|
+
in the permanent evidence store for audit.
|
|
327
377
|
Analyze and synthesize receive bounded, hash-verified prior-stage artifacts in
|
|
328
378
|
their prompt with tools disabled. Review is also tool-free and limited to the
|
|
329
379
|
two turns required by the structured-output protocol:
|
|
@@ -337,8 +387,31 @@ dimension is usable but incomplete; a missing dimension or unmet declared
|
|
|
337
387
|
minimum blocks downstream work. Qualitative gaps remain visible without
|
|
338
388
|
silently changing those mechanical fields.
|
|
339
389
|
|
|
340
|
-
Method
|
|
341
|
-
|
|
390
|
+
Method Skills are external to this project. Recommended evidence Skills are
|
|
391
|
+
selected through `research capability configure`; an owner-selected database,
|
|
392
|
+
domain index, or other external method is admitted from an absolute reviewed
|
|
393
|
+
definition:
|
|
394
|
+
|
|
395
|
+
```bash
|
|
396
|
+
tiangong-ai research capability import \
|
|
397
|
+
--definition /absolute/path/to/external-capability.json \
|
|
398
|
+
--workspace /absolute/path/to/workspace --json
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
`research capability catalog --json` returns the authoritative custom
|
|
402
|
+
definition template. Its source must identify an external git, registry, or
|
|
403
|
+
local artifact with an immutable reference, explicit `expectedTreeSha256`, and
|
|
404
|
+
license. Git references must be full 40-character commits; registry references
|
|
405
|
+
must be exact versions; local references must equal
|
|
406
|
+
`sha256:<expectedTreeSha256>`. Every source type must match the installed whole
|
|
407
|
+
tree before a lock can be written. Skill trees reject symlinks and excessive
|
|
408
|
+
file counts/sizes. Project-owned Tiangong Skills are rejected as imported
|
|
409
|
+
evidence providers. Configure/import refuses to rewrite the lock if any
|
|
410
|
+
existing capability has drifted; restore it or explicitly update its source
|
|
411
|
+
identity and expected hash first.
|
|
412
|
+
|
|
413
|
+
External Skills use absolute paths and explicit permissions, then freeze
|
|
414
|
+
before execution:
|
|
342
415
|
|
|
343
416
|
```bash
|
|
344
417
|
tiangong-ai research capability lock --workspace /absolute/path/to/workspace
|
|
@@ -349,7 +422,14 @@ A capability using `brokered-network` must declare exact `allowedHosts` and may
|
|
|
349
422
|
declare an `http` policy with one exact `accept` value,
|
|
350
423
|
`allowedContentTypes`, `maxResponseBytes`, and `maxItems`. Its optional
|
|
351
424
|
`coverage` block declares dimensions, source types, full-text availability,
|
|
352
|
-
|
|
425
|
+
publication-date availability, and named discovery scopes for the preflight gap
|
|
426
|
+
report. Mark `requiredForDiscovery: true` for every public index or
|
|
427
|
+
owner-whitelisted database the question must exercise. Downstream work is
|
|
428
|
+
blocked unless each such capability produces its own verified broker receipt;
|
|
429
|
+
another local file cannot substitute for it. The current evidence broker
|
|
430
|
+
authorizes bounded GET endpoints only. A non-network external method-guidance
|
|
431
|
+
Skill stages reviewed instructions but does not grant an undeclared tool or
|
|
432
|
+
service call.
|
|
353
433
|
Optional credentials declare logical IDs, exact host scopes, header names, and
|
|
354
434
|
prefixes. Put only the logical value map in `.tiangong-research/.env`:
|
|
355
435
|
|
|
@@ -357,9 +437,21 @@ prefixes. Put only the logical value map in `.tiangong-research/.env`:
|
|
|
357
437
|
TIANGONG_RESEARCH_CAPABILITY_CREDENTIALS_JSON={"source.example.api":"owner-provided-value"}
|
|
358
438
|
```
|
|
359
439
|
|
|
440
|
+
Prefer the non-echoing configuration command over hand editing:
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
tiangong-ai research capability credential set \
|
|
444
|
+
--id source.example.api --from-env OWNER_DATABASE_API_KEY \
|
|
445
|
+
--workspace /absolute/path/to/workspace --json
|
|
446
|
+
```
|
|
447
|
+
|
|
360
448
|
The broker injects declared credentials only for admitted HTTPS hosts. Agent
|
|
361
449
|
processes do not receive this variable. Keep the file owner-only (`chmod 600`)
|
|
362
|
-
and
|
|
450
|
+
and run `research capability doctor --live` plus production
|
|
451
|
+
`research workspace doctor --agent-smoke --capability-smoke` before a run.
|
|
452
|
+
Capability doctor retries only one 429 response with bounded `Retry-After`
|
|
453
|
+
backoff; deterministic 4xx, missing subscription, authentication, drift, and
|
|
454
|
+
content-type failures stop explicitly. The broker preserves a
|
|
363
455
|
sanitized non-2xx excerpt, safe request ID, and `Retry-After`; it supports JSON
|
|
364
456
|
Pointer extraction, bounded item and estimated-token views, and an explicit
|
|
365
457
|
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;
|