@nowcrew/daemon 0.5.51 → 0.6.0

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 (42) hide show
  1. package/dist/agent-ability/controller.js +19 -0
  2. package/dist/agent-ability/materializer.js +327 -0
  3. package/dist/agent-ability/resolver.js +408 -0
  4. package/dist/agent-ability/runtime.js +27 -0
  5. package/dist/agent-ability/types.js +111 -0
  6. package/dist/control-plane-url.js +16 -0
  7. package/dist/control-request-types.js +1 -0
  8. package/dist/execution-protocol.js +20 -0
  9. package/dist/execution-runner.js +2 -0
  10. package/dist/local-executor.js +6 -3
  11. package/dist/machine-info.js +5 -1
  12. package/dist/remote/claude-bridge.js +558 -0
  13. package/dist/remote/claude-channel.js +164 -0
  14. package/dist/remote/codex-client.js +451 -0
  15. package/dist/remote/codex-runtime.js +77 -0
  16. package/dist/remote/config.js +135 -0
  17. package/dist/remote/gateway.js +879 -0
  18. package/dist/remote/identity.js +39 -0
  19. package/dist/remote/owner.js +77 -0
  20. package/dist/remote/protocol.js +211 -0
  21. package/dist/remote/remote-cli.js +254 -0
  22. package/dist/remote/runtime-probe.js +182 -0
  23. package/dist/remote/session-discovery.js +249 -0
  24. package/dist/remote/wrapper.js +40 -0
  25. package/dist/remote-web/assets/index-B_6VM_tw.js +94 -0
  26. package/dist/remote-web/assets/index-L6EiQbJn.css +1 -0
  27. package/dist/remote-web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  28. package/dist/remote-web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  29. package/dist/remote-web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  30. package/dist/remote-web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  31. package/dist/remote-web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  32. package/dist/remote-web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  33. package/dist/remote-web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  34. package/dist/remote-web/icons/nowwork-192.png +0 -0
  35. package/dist/remote-web/icons/nowwork-512.png +0 -0
  36. package/dist/remote-web/icons/nowwork.svg +7 -0
  37. package/dist/remote-web/index.html +20 -0
  38. package/dist/remote-web/manifest.webmanifest +13 -0
  39. package/dist/remote-web/sw.js +12 -0
  40. package/dist/runtime-health.js +158 -0
  41. package/dist/serve.js +19 -15
  42. package/package.json +2 -1
package/dist/serve.js CHANGED
@@ -8,7 +8,7 @@ import { randomUUID } from "node:crypto";
8
8
  import { initSlog, dslog, setSlogDefaults, drainSpool, flushSlog } from "./slog.js";
9
9
  import { mergeRunAgentResults, reportScheduledStartFailure, runAgent } from "./runner.js";
10
10
  import { buildOriginDecisionRetryPrompt, buildScheduledPrompt } from "./prompt.js";
11
- import { collectMachineHello, cliVersion, daemonVersion, daemonCapabilities, detectExecutionRuntimesWithSignal, EXECUTION_PROTOCOL, } from "./machine-info.js";
11
+ import { collectMachineHello, cliVersion, daemonVersion, detectExecutionRuntimesWithSignal, } from "./machine-info.js";
12
12
  import { conservativeExecutionRuntimes, createRuntimeProbeCoordinator, } from "./runtime-probe.js";
13
13
  import { listWorkspace, readWorkspaceFile } from "./workspace-fs.js";
14
14
  import { listSkills } from "./skills.js";
@@ -22,7 +22,6 @@ import { createExecutionJournal } from "./execution-journal.js";
22
22
  import { createExecutionTelemetryJournal } from "./execution-telemetry-journal.js";
23
23
  import { ExecutionRejectedSchema, ExecutionSnapshotSchema, LegacyAgentStartSchema, ServerToDaemonExecutionFrameSchema, } from "./execution-protocol.js";
24
24
  import { hashExecutionSpec, runExecution, } from "./execution-runner.js";
25
- import { executionBackendCapability } from "./execution-backend.js";
26
25
  import { awaitWithCancellation, createRuntimeCancellation, RuntimeCancelledError, } from "./runtime-cancellation.js";
27
26
  import { createShutdownDeadline, readTestShutdownConfiguration } from "./shutdown-deadline.js";
28
27
  import { closeWebSocketWithinDeadline } from "./websocket-shutdown.js";
@@ -40,27 +39,18 @@ import { createProjectRegistry } from "./project-skills/registry.js";
40
39
  import { createProjectSkillsController, } from "./project-skills/controller.js";
41
40
  import { PROJECT_SKILLS_CAPABILITY } from "./project-skills/types.js";
42
41
  import { createAgentProjectionCoordinator } from "./project-skills/agent-projection-coordinator.js";
42
+ import { createAgentAbilityRuntime } from "./agent-ability/runtime.js";
43
43
  import { createProjectSkillsReconciler, ProjectProjectionError, } from "./project-skills/reconciler.js";
44
44
  import { parseMemoryPruneTraceId } from "./memory-prune-diagnostics.js";
45
+ import { handleRuntimeProbeFrame, probeRuntimeHealth } from "./runtime-health.js";
46
+ import { buildControlPlaneUrl } from "./control-plane-url.js";
47
+ export { buildControlPlaneUrl } from "./control-plane-url.js";
45
48
  // normalize.ts 的活动种类 → activity 枚举
46
49
  const ACTIVITY_MAP = {
47
50
  init: "working", text: "thinking", reading: "reading", sending: "sending",
48
51
  checking: "checking", claiming: "claiming", crew: "working", tool: "working",
49
52
  tool_result: "working", done: "done", error: "error",
50
53
  };
51
- export function buildControlPlaneUrl(serverUrl, machineToken, runtimePlatform = process.platform, jobObjectProbe, projectSkillsAvailable = true) {
52
- const query = new URLSearchParams({ key: machineToken });
53
- if (executionBackendCapability(runtimePlatform, jobObjectProbe).supported) {
54
- query.set("execution_min", String(EXECUTION_PROTOCOL.min));
55
- query.set("execution_max", String(EXECUTION_PROTOCOL.max));
56
- }
57
- for (const capability of daemonCapabilities(runtimePlatform)) {
58
- if (capability !== PROJECT_SKILLS_CAPABILITY || projectSkillsAvailable) {
59
- query.append("capability", capability);
60
- }
61
- }
62
- return `${serverUrl.replace(/^http/, "ws").replace(/\/+$/, "")}/daemon/connect?${query.toString()}`;
63
- }
64
54
  export function serve(config, opts = {}) {
65
55
  let stopped = false;
66
56
  let ws = null;
@@ -114,6 +104,7 @@ export function serve(config, opts = {}) {
114
104
  },
115
105
  });
116
106
  const projectionCoordinator = createAgentProjectionCoordinator();
107
+ const agentAbilityRuntime = createAgentAbilityRuntime(config.agentsRoot, opts.agentAbility);
117
108
  let projectSkillsController;
118
109
  const projectSkillsReconciler = opts.projectSkills?.reconciler ?? createProjectSkillsReconciler({
119
110
  agentsRoot: config.agentsRoot,
@@ -589,6 +580,7 @@ export function serve(config, opts = {}) {
589
580
  const execution = executeProtocol(config, spec, {
590
581
  ...opts.execution?.dependencies,
591
582
  projectSkills: opts.execution?.dependencies?.projectSkills ?? initializedProjectSkillsReconciler,
583
+ abilityRelease: opts.execution?.dependencies?.abilityRelease ?? agentAbilityRuntime.materializer,
592
584
  ...(agentMemory === undefined ? {} : { agentMemory }),
593
585
  journal: executionJournal,
594
586
  facts: {
@@ -698,6 +690,18 @@ export function serve(config, opts = {}) {
698
690
  catch { /* server 会按请求超时处理 */ }
699
691
  return;
700
692
  }
693
+ if (msg.type === "runtime-health:probe") {
694
+ const result = await handleRuntimeProbeFrame(msg, opts.runtimeHealth?.probe ?? probeRuntimeHealth);
695
+ if (result !== null) {
696
+ try {
697
+ ws?.send(JSON.stringify({ type: "fs:result", ...result }));
698
+ }
699
+ catch { /* server 会超时 */ }
700
+ }
701
+ return;
702
+ }
703
+ if (await agentAbilityRuntime.tryHandleControlMessage(msg, serverCapabilities, (frame) => ws?.send(JSON.stringify(frame))))
704
+ return;
701
705
  // 导入 raft agent 工作区:inspect 反填 name/description;import 复制用户内容
702
706
  if (msg.type === "raft:inspect" || msg.type === "raft:import") {
703
707
  const req = msg;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nowcrew/daemon",
3
- "version": "0.5.51",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "crew daemon — 运行在用户机器:拉起/管理 agent 进程,注入 crew CLI,归一化 runtime 事件",
6
6
  "license": "Apache-2.0",
@@ -21,6 +21,7 @@
21
21
  "@nowcrew/cli": "^0.4.13",
22
22
  "cross-spawn": "^7.0.6",
23
23
  "ws": "^8",
24
+ "yaml": "^2.8.1",
24
25
  "zod": "^3.23.0"
25
26
  },
26
27
  "optionalDependencies": {