opensyn 0.1.0 → 0.1.1

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
@@ -18,6 +18,7 @@ Default workspace behavior:
18
18
  - `openclaw enable_opensyn` uses the current OpenClaw workspace if no project path is provided
19
19
  - `openclaw enable_opensyn` also bootstraps the managed shell hook, starts the plugin-managed background `watch-linux` collector, and starts the plugin-managed host-model distillation worker
20
20
  - `openclaw status_opensyn` returns a compact `next=...` hint so the customer can see the next required action immediately
21
+ - add `--json` only when full diagnostics are needed
21
22
 
22
23
  Fallback local-dev install:
23
24
 
package/README.zh-CN.md CHANGED
@@ -18,6 +18,7 @@ openclaw status_opensyn
18
18
  - `openclaw enable_opensyn` 如果不传项目路径,会直接使用当前 OpenClaw workspace
19
19
  - `openclaw enable_opensyn` 还会完成托管 shell hook 自举,并拉起插件托管的后台 `watch-linux` 采集器和 host-model distillation worker
20
20
  - `openclaw status_opensyn` 会直接返回统一的 `next=...` 提示,让客户马上知道下一步动作
21
+ - 只有在排障时才需要追加 `--json` 查看完整诊断信息
21
22
 
22
23
  本地开发联调安装:
23
24
 
package/index.ts CHANGED
@@ -1585,6 +1585,16 @@ function summarizeAssetApprovalResult(result: {
1585
1585
  return `${base} | synced_records=${String(sync.applied_record_count ?? 0)} | host=${sync.host || "unknown"}`;
1586
1586
  }
1587
1587
 
1588
+ function extractNextStep(result: unknown): UserNextStep | undefined {
1589
+ if (typeof result !== "object" || result === null) {
1590
+ return undefined;
1591
+ }
1592
+ if ("next_step" in result) {
1593
+ return (result as { next_step?: UserNextStep }).next_step;
1594
+ }
1595
+ return undefined;
1596
+ }
1597
+
1588
1598
  function looksLikeContextObject(result: unknown): boolean {
1589
1599
  return (
1590
1600
  typeof result === "object" &&
@@ -2087,11 +2097,21 @@ async function repairAutonomousCollection(
2087
2097
  };
2088
2098
  }
2089
2099
 
2090
- function printCliResult(result: unknown): void {
2100
+ function printCliResult(result: unknown, jsonOutput = false): void {
2091
2101
  const summary = summarizeResult(result);
2092
2102
  if (summary) {
2093
2103
  console.log(summary);
2094
2104
  }
2105
+ const nextStep = extractNextStep(result);
2106
+ if (!jsonOutput) {
2107
+ if (nextStep && nextStep.code !== "none") {
2108
+ console.log(`Next: ${nextStep.summary}`);
2109
+ if (nextStep.action) {
2110
+ console.log(`Action: ${nextStep.action}`);
2111
+ }
2112
+ }
2113
+ return;
2114
+ }
2095
2115
  console.log(JSON.stringify(result, null, 2));
2096
2116
  }
2097
2117
 
@@ -2134,7 +2154,8 @@ export default {
2134
2154
  )
2135
2155
  .argument("[project_root]", "Optional project root. Defaults to the current OpenClaw workspace.")
2136
2156
  .option("--shell <shell>", "Shell to manage for command capture.")
2137
- .action(async (projectRootArg?: string, opts?: { shell?: string }) => {
2157
+ .option("--json", "Print the full JSON result.")
2158
+ .action(async (projectRootArg?: string, opts?: { shell?: string; json?: boolean }) => {
2138
2159
  const projectRoot = resolveCliProjectRoot(projectRootArg);
2139
2160
  const resolved = await resolveCliConfig(projectRoot, true);
2140
2161
  const result = await enableAutonomousCollection(resolved, {
@@ -2142,7 +2163,7 @@ export default {
2142
2163
  shell: opts?.shell,
2143
2164
  updated_by: "openclaw_cli",
2144
2165
  });
2145
- printCliResult(result);
2166
+ printCliResult(result, opts?.json);
2146
2167
  });
2147
2168
 
2148
2169
  program
@@ -2152,7 +2173,8 @@ export default {
2152
2173
  )
2153
2174
  .argument("[project_root]", "Optional project root. Defaults to the current OpenClaw workspace.")
2154
2175
  .option("--shell <shell>", "Shell to stop managing for command capture.")
2155
- .action(async (projectRootArg?: string, opts?: { shell?: string }) => {
2176
+ .option("--json", "Print the full JSON result.")
2177
+ .action(async (projectRootArg?: string, opts?: { shell?: string; json?: boolean }) => {
2156
2178
  const projectRoot = resolveCliProjectRoot(projectRootArg);
2157
2179
  const resolved = await resolveCliConfig(projectRoot, true);
2158
2180
  const result = await disableAutonomousCollection(resolved, {
@@ -2160,7 +2182,7 @@ export default {
2160
2182
  shell: opts?.shell,
2161
2183
  updated_by: "openclaw_cli",
2162
2184
  });
2163
- printCliResult(result);
2185
+ printCliResult(result, opts?.json);
2164
2186
  });
2165
2187
 
2166
2188
  program
@@ -2170,14 +2192,15 @@ export default {
2170
2192
  )
2171
2193
  .argument("[project_root]", "Optional project root. Defaults to the current OpenClaw workspace.")
2172
2194
  .option("--shell <shell>", "Shell to inspect for command capture.")
2173
- .action(async (projectRootArg?: string, opts?: { shell?: string }) => {
2195
+ .option("--json", "Print the full JSON result.")
2196
+ .action(async (projectRootArg?: string, opts?: { shell?: string; json?: boolean }) => {
2174
2197
  const projectRoot = resolveCliProjectRoot(projectRootArg);
2175
2198
  const resolved = await resolveCliConfig(projectRoot);
2176
2199
  const result = await getAutonomousCollectionStatus(resolved, {
2177
2200
  project_root: projectRoot,
2178
2201
  shell: opts?.shell,
2179
2202
  });
2180
- printCliResult(result);
2203
+ printCliResult(result, opts?.json);
2181
2204
  });
2182
2205
 
2183
2206
  program
@@ -2187,14 +2210,15 @@ export default {
2187
2210
  )
2188
2211
  .argument("[project_root]", "Optional project root. Defaults to the current OpenClaw workspace.")
2189
2212
  .option("--shell <shell>", "Shell to inspect for command capture.")
2190
- .action(async (projectRootArg?: string, opts?: { shell?: string }) => {
2213
+ .option("--json", "Print the full JSON result.")
2214
+ .action(async (projectRootArg?: string, opts?: { shell?: string; json?: boolean }) => {
2191
2215
  const projectRoot = resolveCliProjectRoot(projectRootArg);
2192
2216
  const resolved = await resolveCliConfig(projectRoot);
2193
2217
  const result = await getAutonomousCollectionStatus(resolved, {
2194
2218
  project_root: projectRoot,
2195
2219
  shell: opts?.shell,
2196
2220
  });
2197
- printCliResult(result);
2221
+ printCliResult(result, opts?.json);
2198
2222
  });
2199
2223
 
2200
2224
  program
@@ -2204,14 +2228,15 @@ export default {
2204
2228
  )
2205
2229
  .argument("[project_root]", "Optional project root. Defaults to the current OpenClaw workspace.")
2206
2230
  .option("--shell <shell>", "Shell to inspect for command capture.")
2207
- .action(async (projectRootArg?: string, opts?: { shell?: string }) => {
2231
+ .option("--json", "Print the full JSON result.")
2232
+ .action(async (projectRootArg?: string, opts?: { shell?: string; json?: boolean }) => {
2208
2233
  const projectRoot = resolveCliProjectRoot(projectRootArg);
2209
2234
  const resolved = await resolveCliConfig(projectRoot);
2210
2235
  const result = await getAutonomousCollectionStatus(resolved, {
2211
2236
  project_root: projectRoot,
2212
2237
  shell: opts?.shell,
2213
2238
  });
2214
- printCliResult(result);
2239
+ printCliResult(result, opts?.json);
2215
2240
  });
2216
2241
 
2217
2242
  program
@@ -2224,14 +2249,15 @@ export default {
2224
2249
  "Optional project root. Defaults to the current OpenClaw workspace.",
2225
2250
  )
2226
2251
  .option("--shell <shell>", "Shell to repair for command capture.")
2227
- .action(async (projectRootArg?: string, opts?: { shell?: string }) => {
2252
+ .option("--json", "Print the full JSON result.")
2253
+ .action(async (projectRootArg?: string, opts?: { shell?: string; json?: boolean }) => {
2228
2254
  const projectRoot = resolveCliProjectRoot(projectRootArg);
2229
2255
  const resolved = await resolveCliConfig(projectRoot, true);
2230
2256
  const result = await repairAutonomousCollection(resolved, {
2231
2257
  project_root: projectRoot,
2232
2258
  shell: opts?.shell,
2233
2259
  });
2234
- printCliResult(result);
2260
+ printCliResult(result, opts?.json);
2235
2261
  });
2236
2262
 
2237
2263
  const opensyn = program
@@ -2243,7 +2269,8 @@ export default {
2243
2269
  .description("Alias for openclaw enable_opensyn.")
2244
2270
  .argument("[project_root]")
2245
2271
  .option("--shell <shell>")
2246
- .action(async (projectRootArg?: string, opts?: { shell?: string }) => {
2272
+ .option("--json", "Print the full JSON result.")
2273
+ .action(async (projectRootArg?: string, opts?: { shell?: string; json?: boolean }) => {
2247
2274
  const projectRoot = resolveCliProjectRoot(projectRootArg);
2248
2275
  const resolved = await resolveCliConfig(projectRoot, true);
2249
2276
  const result = await enableAutonomousCollection(resolved, {
@@ -2251,7 +2278,7 @@ export default {
2251
2278
  shell: opts?.shell,
2252
2279
  updated_by: "openclaw_cli",
2253
2280
  });
2254
- printCliResult(result);
2281
+ printCliResult(result, opts?.json);
2255
2282
  });
2256
2283
 
2257
2284
  opensyn
@@ -2259,7 +2286,8 @@ export default {
2259
2286
  .description("Alias for openclaw disable_opensyn.")
2260
2287
  .argument("[project_root]")
2261
2288
  .option("--shell <shell>")
2262
- .action(async (projectRootArg?: string, opts?: { shell?: string }) => {
2289
+ .option("--json", "Print the full JSON result.")
2290
+ .action(async (projectRootArg?: string, opts?: { shell?: string; json?: boolean }) => {
2263
2291
  const projectRoot = resolveCliProjectRoot(projectRootArg);
2264
2292
  const resolved = await resolveCliConfig(projectRoot, true);
2265
2293
  const result = await disableAutonomousCollection(resolved, {
@@ -2267,7 +2295,7 @@ export default {
2267
2295
  shell: opts?.shell,
2268
2296
  updated_by: "openclaw_cli",
2269
2297
  });
2270
- printCliResult(result);
2298
+ printCliResult(result, opts?.json);
2271
2299
  });
2272
2300
 
2273
2301
  opensyn
@@ -2275,14 +2303,15 @@ export default {
2275
2303
  .description("Alias for openclaw status_opensyn.")
2276
2304
  .argument("[project_root]")
2277
2305
  .option("--shell <shell>")
2278
- .action(async (projectRootArg?: string, opts?: { shell?: string }) => {
2306
+ .option("--json", "Print the full JSON result.")
2307
+ .action(async (projectRootArg?: string, opts?: { shell?: string; json?: boolean }) => {
2279
2308
  const projectRoot = resolveCliProjectRoot(projectRootArg);
2280
2309
  const resolved = await resolveCliConfig(projectRoot);
2281
2310
  const result = await getAutonomousCollectionStatus(resolved, {
2282
2311
  project_root: projectRoot,
2283
2312
  shell: opts?.shell,
2284
2313
  });
2285
- printCliResult(result);
2314
+ printCliResult(result, opts?.json);
2286
2315
  });
2287
2316
 
2288
2317
  opensyn
@@ -2290,14 +2319,15 @@ export default {
2290
2319
  .description("Alias for openclaw doctor_opensyn.")
2291
2320
  .argument("[project_root]")
2292
2321
  .option("--shell <shell>")
2293
- .action(async (projectRootArg?: string, opts?: { shell?: string }) => {
2322
+ .option("--json", "Print the full JSON result.")
2323
+ .action(async (projectRootArg?: string, opts?: { shell?: string; json?: boolean }) => {
2294
2324
  const projectRoot = resolveCliProjectRoot(projectRootArg);
2295
2325
  const resolved = await resolveCliConfig(projectRoot);
2296
2326
  const result = await getAutonomousCollectionStatus(resolved, {
2297
2327
  project_root: projectRoot,
2298
2328
  shell: opts?.shell,
2299
2329
  });
2300
- printCliResult(result);
2330
+ printCliResult(result, opts?.json);
2301
2331
  });
2302
2332
 
2303
2333
  opensyn
@@ -2305,14 +2335,15 @@ export default {
2305
2335
  .description("Repair OpenSyn runtime and refresh the managed shell hook.")
2306
2336
  .argument("[project_root]")
2307
2337
  .option("--shell <shell>")
2308
- .action(async (projectRootArg?: string, opts?: { shell?: string }) => {
2338
+ .option("--json", "Print the full JSON result.")
2339
+ .action(async (projectRootArg?: string, opts?: { shell?: string; json?: boolean }) => {
2309
2340
  const projectRoot = resolveCliProjectRoot(projectRootArg);
2310
2341
  const resolved = await resolveCliConfig(projectRoot, true);
2311
2342
  const result = await repairAutonomousCollection(resolved, {
2312
2343
  project_root: projectRoot,
2313
2344
  shell: opts?.shell,
2314
2345
  });
2315
- printCliResult(result);
2346
+ printCliResult(result, opts?.json);
2316
2347
  });
2317
2348
  },
2318
2349
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opensyn",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "OpenClaw plugin for OpenSyn autonomous local collection, distillation, and host overlay projection.",
5
5
  "type": "module",
6
6
  "private": false,