@opscompass/opscompass-cli 1.3.9 → 1.3.11

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
@@ -162,35 +162,14 @@ The MLSS source-selection feature requires staged deployment: MLSS service first
162
162
 
163
163
  ## AI Chat Documents host integration
164
164
 
165
- The CLI pins the released npm package `@opscompass/harness-core@0.7.1`; a local harness checkout/link is no longer required. Fully restart Studio after adopting the published CLI so its main process loads the new runtime.
165
+ The standalone CLI does not start or install a chat runtime. Studio owns its Harness runtime and can still use the CLI commands and the Documents facade. Release the Studio migration before distributing this CLI to Studio users: older Studio builds need their existing pinned CLI for chat.
166
166
 
167
- Only failure to find the top-level `@opscompass/harness-core` package becomes the friendly AI-chat-unavailable error. Missing transitive packages and internal harness modules retain their original loader errors, including when the importer path contains the harness package name.
168
-
169
- The CLI supplies a trusted per-prompt run budget of **120 tool executions**, **5 identical calls**, and **10 minutes** to `createCliAiChatRuntime`; Studio inherits this through its selected CLI. These values do not alter Harness's library defaults or reset when a skill changes. Shared generic file and Bash calls count toward the same run ceiling; only tools with trusted skill ownership also consume that skill's allowance.
170
-
171
- Trusted host code may explicitly pass `runBudget: { maxToolCalls, maxIdenticalCalls, maxDurationMs }` alongside `cliInvocation`. An explicit object completely replaces the CLI budget and is forwarded unchanged for Harness validation; omitted fields in that object use Harness's library defaults (20 executions, 5 identical calls, 10 minutes). Model output and renderer input must not supply this configuration. Both the CLI default and explicit budgets require `EXECUTION_POLICY_VERSION === 1`, and embedded invocation independently requires `supportsCliInvocation === true`; either missing capability fails before creating a conversation. No separate numeric Studio override is needed.
172
-
173
- The CLI lockfile pins published Harness `0.7.1`, which includes public Skills `0.2.3` with shared Resources (60 calls) and Oracle Licensing (40 calls) limits. The bundle routes inventory-only requests to `resources list` and rejects oversized stdout from the shared CLI runner rather than returning clipped JSON; the bulk workflow's separate JSON runner is unchanged. It retains embedded invocation and warning-safe JSON, and bundles Sandbox `0.0.81` with unmodified upstream Forge `1.4.2`. Installation needs no customer patch script or additional registry credentials.
174
-
175
- The production audit gate accepts only a valid, successful report with zero production vulnerabilities; no advisory exception remains. Regression tests exercise PEM Buffer handling, malformed-signature rejection, and Sandbox certificate/TLS behavior through the actual installed dependencies.
176
-
177
- Studio can create the local Documents facade from the runtime harness:
167
+ The Documents facade takes an already-created Harness from the host:
178
168
 
179
169
  ```js
180
- import { createCliAiChatRuntime } from "./lib/aiChatRuntime.js";
181
170
  import { createCliAiChatDocuments } from "./lib/aiChatDocuments.js";
182
171
 
183
- const harness = await createCliAiChatRuntime({ workspaceRoot, onEvent });
184
172
  const documents = createCliAiChatDocuments({ harness, onChanged });
185
173
  ```
186
174
 
187
175
  The facade provides `list(directory?)`, `mkdir(path)`, `importFile(sourcePath, destinationPath)`, `preview(path)`, `exportFile(path, destinationPath)`, `delete(path)`, and `dispose()`. Import takes the native-dialog absolute source path and a Documents-root-relative destination; export takes a Documents-root-relative source and the native save-dialog absolute destination. Renderer requests contain only relative document paths, with the host consumer supplying dialog paths in main. The host consumer owns the facade lifecycle: call `documents.dispose()` when replacing the runtime; it waits for local operations but does not dispose the harness.
188
-
189
-
190
- The AI Chat adapter exports `supportsCliInvocation` and accepts optional host-owned
191
- `cliInvocation: { executable, args, env }`. This lets a packaged desktop host run
192
- its selected JavaScript CLI through its embedded runtime while preserving the
193
- CLI command identity, defaults home and cancellation. An explicit environment is
194
- complete, not an ambient overlay. The adapter rejects older Harness versions
195
- that cannot honor the invocation; the matching public Skills bundle must support
196
- it too. Standalone callers can omit the option.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opscompass/opscompass-cli",
3
- "version": "1.3.9",
3
+ "version": "1.3.11",
4
4
  "description": "Calls OpsCompass's APIs",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -28,8 +28,7 @@
28
28
  "node": "^22.19.0 || ^24.0.0"
29
29
  },
30
30
  "dependencies": {
31
- "@opscompass/harness-core": "0.7.1",
32
- "@opscompass/opscompass-api": "^1.3.8",
31
+ "@opscompass/opscompass-api": "^1.3.10",
33
32
  "adm-zip": "^0.6.1",
34
33
  "axios": "^1.20.0",
35
34
  "better-sqlite3": "^13.0.1",
@@ -38,7 +37,7 @@
38
37
  "open": "^8.2.1",
39
38
  "openpgp": "6.2.2",
40
39
  "semver": "^7.3.7",
41
- "tar": "^7.5.22"
40
+ "tar": "8.1.0"
42
41
  },
43
42
  "devDependencies": {
44
43
  "jest": "^30.4.2"
@@ -1,51 +0,0 @@
1
- import { cliCommand, opscompassHome } from "../environment/current.js";
2
-
3
- // DECISION: the selected CLI package owns this adapter so Studio uses the
4
- // same CLI home, executable, and packaged harness runtime.
5
- let harnessCoreLoader = () => import("@opscompass/harness-core");
6
-
7
- export function __setHarnessCoreLoaderForTesting(loader) {
8
- harnessCoreLoader = loader;
9
- }
10
-
11
- export const supportsCliInvocation = true;
12
-
13
- // DECISION: The CLI owns the approved run ceiling; Harness library defaults stay compatible.
14
- /**
15
- * @param {{workspaceRoot: string, onEvent: Function, cliEntryPoint?: string,
16
- * cliInvocation?: import('@opscompass/harness-core').CliInvocation,
17
- * runBudget?: import('@opscompass/harness-core').RunBudgetOptions}} options
18
- */
19
- export async function createCliAiChatRuntime({ workspaceRoot, onEvent, cliEntryPoint = cliCommand, cliInvocation,
20
- runBudget = { maxToolCalls: 120, maxIdenticalCalls: 5, maxDurationMs: 600_000 } }) {
21
- let core;
22
- try {
23
- core = await harnessCoreLoader();
24
- } catch (error) {
25
- if (
26
- error &&
27
- error.code === "ERR_MODULE_NOT_FOUND" &&
28
- /^Cannot find package '@opscompass\/harness-core' imported from /.test(error.message)
29
- ) {
30
- throw new Error("Opscompass AI chat is unavailable because the harness dependency could not be loaded.");
31
- }
32
- throw error;
33
- }
34
- if (cliInvocation && core.supportsCliInvocation !== true) {
35
- throw new Error("Packaged AI chat requires an updated Harness with CLI invocation support.");
36
- }
37
- if (core.EXECUTION_POLICY_VERSION !== 1) {
38
- throw new Error("This AI chat runtime does not support execution budgets. Install a compatible CLI/Harness release.");
39
- }
40
- const harnessOptions = {
41
- workspaceRoot,
42
- opscompassHome,
43
- cliExecutable: cliCommand,
44
- onEvent,
45
- cliEntryPoint,
46
- modelAccessSource: "customer",
47
- ...(cliInvocation ? { cliInvocation } : {}),
48
- runBudget,
49
- };
50
- return core.createOpscompassHarness(harnessOptions);
51
- }