@haaaiawd/second-nature 0.1.16 → 0.1.18
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/index.js +855 -851
- package/openclaw.plugin.json +29 -29
- package/package.json +52 -52
- package/runtime/cli/commands/index.d.ts +14 -14
- package/runtime/cli/commands/index.js +193 -193
- package/runtime/cli/explain/explain-surface-subject.d.ts +8 -8
- package/runtime/cli/explain/explain-surface-subject.js +9 -9
- package/runtime/cli/explain/format-explanation.d.ts +12 -12
- package/runtime/cli/explain/format-explanation.js +12 -12
- package/runtime/cli/explain/resolve-subject.js +41 -41
- package/runtime/cli/host-capability/classify-delivery.d.ts +14 -14
- package/runtime/cli/host-capability/classify-delivery.js +20 -20
- package/runtime/cli/host-capability/probe-host-capability.d.ts +2 -2
- package/runtime/cli/host-capability/probe-host-capability.js +58 -58
- package/runtime/cli/host-capability/record-host-capability.d.ts +6 -6
- package/runtime/cli/host-capability/record-host-capability.js +14 -14
- package/runtime/cli/host-capability/types.d.ts +71 -71
- package/runtime/cli/host-capability/types.js +6 -6
- package/runtime/cli/host-smoke/run-host-smoke.d.ts +2 -2
- package/runtime/cli/host-smoke/run-host-smoke.js +40 -40
- package/runtime/cli/host-smoke/types.d.ts +35 -35
- package/runtime/cli/host-smoke/types.js +6 -6
- package/runtime/cli/index.js +58 -54
- package/runtime/cli/ops/heartbeat-surface.d.ts +38 -35
- package/runtime/cli/ops/heartbeat-surface.js +73 -71
- package/runtime/cli/ops/ops-router.d.ts +19 -16
- package/runtime/cli/ops/ops-router.js +89 -87
- package/runtime/cli/ops/show-operator-fallback.d.ts +13 -13
- package/runtime/cli/ops/show-operator-fallback.js +22 -22
- package/runtime/cli/ops/workspace-heartbeat-runner.d.ts +19 -10
- package/runtime/cli/ops/workspace-heartbeat-runner.js +39 -26
- package/runtime/cli/read-models/index.d.ts +29 -29
- package/runtime/cli/read-models/index.js +256 -256
- package/runtime/cli/read-models/operator-explain-map.d.ts +6 -6
- package/runtime/cli/read-models/operator-explain-map.js +10 -10
- package/runtime/cli/read-models/types.d.ts +79 -79
- package/runtime/cli/runtime/runtime-artifact-boundary.d.ts +28 -28
- package/runtime/cli/runtime/runtime-artifact-boundary.js +94 -94
- package/runtime/connectors/base/contract.d.ts +87 -87
- package/runtime/connectors/base/execution-policy.d.ts +47 -47
- package/runtime/connectors/base/execution-policy.js +82 -82
- package/runtime/connectors/base/index.d.ts +8 -8
- package/runtime/connectors/base/index.js +8 -8
- package/runtime/connectors/base/manifest.d.ts +64 -64
- package/runtime/connectors/base/manifest.js +86 -86
- package/runtime/connectors/base/map-life-evidence.d.ts +16 -16
- package/runtime/connectors/base/map-life-evidence.js +79 -79
- package/runtime/connectors/base/policy-layer.d.ts +29 -29
- package/runtime/connectors/base/policy-layer.js +198 -198
- package/runtime/connectors/base/route-planner.js +99 -99
- package/runtime/connectors/index.d.ts +5 -5
- package/runtime/connectors/index.js +5 -5
- package/runtime/connectors/near-real/near-real-connector-smoke.d.ts +19 -19
- package/runtime/connectors/near-real/near-real-connector-smoke.js +152 -152
- package/runtime/core/second-nature/heartbeat/heartbeat-executor.js +114 -114
- package/runtime/core/second-nature/heartbeat/heartbeat-loop.d.ts +63 -63
- package/runtime/core/second-nature/heartbeat/heartbeat-loop.js +139 -139
- package/runtime/core/second-nature/heartbeat/index.d.ts +8 -8
- package/runtime/core/second-nature/heartbeat/index.js +7 -7
- package/runtime/core/second-nature/heartbeat/run-heartbeat-cycle.d.ts +21 -21
- package/runtime/core/second-nature/heartbeat/run-heartbeat-cycle.js +35 -35
- package/runtime/core/second-nature/heartbeat/runtime-snapshot.d.ts +28 -28
- package/runtime/core/second-nature/heartbeat/runtime-snapshot.js +35 -35
- package/runtime/core/second-nature/heartbeat/signal.d.ts +42 -42
- package/runtime/core/second-nature/heartbeat/snapshot-builder.d.ts +51 -51
- package/runtime/core/second-nature/index.d.ts +22 -22
- package/runtime/core/second-nature/index.js +22 -22
- package/runtime/core/second-nature/orchestrator/effect-dispatcher.d.ts +100 -100
- package/runtime/core/second-nature/orchestrator/effect-dispatcher.js +144 -144
- package/runtime/core/second-nature/orchestrator/guard-layer.d.ts +8 -8
- package/runtime/core/second-nature/orchestrator/guard-layer.js +110 -110
- package/runtime/core/second-nature/orchestrator/intent-planner.d.ts +13 -13
- package/runtime/core/second-nature/orchestrator/intent-planner.js +199 -199
- package/runtime/core/second-nature/orchestrator/lease-manager.d.ts +14 -14
- package/runtime/core/second-nature/orchestrator/lease-manager.js +58 -58
- package/runtime/core/second-nature/outreach/build-outreach-draft-request.d.ts +6 -6
- package/runtime/core/second-nature/outreach/build-outreach-draft-request.js +63 -63
- package/runtime/core/second-nature/outreach/delivery-target.d.ts +26 -26
- package/runtime/core/second-nature/outreach/delivery-target.js +70 -70
- package/runtime/core/second-nature/outreach/dispatch-user-outreach.d.ts +38 -38
- package/runtime/core/second-nature/outreach/dispatch-user-outreach.js +119 -119
- package/runtime/core/second-nature/outreach/judge-input-from-snapshot.d.ts +7 -7
- package/runtime/core/second-nature/outreach/judge-input-from-snapshot.js +45 -45
- package/runtime/core/second-nature/outreach/judge-outreach.d.ts +40 -40
- package/runtime/core/second-nature/outreach/judge-outreach.js +121 -121
- package/runtime/core/second-nature/quiet/run-source-backed-quiet.d.ts +21 -21
- package/runtime/core/second-nature/quiet/run-source-backed-quiet.js +123 -123
- package/runtime/core/second-nature/rhythm/planner-rhythm-window.d.ts +15 -15
- package/runtime/core/second-nature/rhythm/planner-rhythm-window.js +52 -52
- package/runtime/core/second-nature/rhythm/policy-bridge.d.ts +19 -19
- package/runtime/core/second-nature/rhythm/policy-bridge.js +34 -34
- package/runtime/core/second-nature/runtime/service-entry.js +45 -45
- package/runtime/core/second-nature/types.d.ts +51 -51
- package/runtime/guidance/draft-outreach-message.d.ts +7 -7
- package/runtime/guidance/draft-outreach-message.js +42 -42
- package/runtime/guidance/evidence-guidance.d.ts +40 -40
- package/runtime/guidance/evidence-guidance.js +52 -52
- package/runtime/guidance/index.d.ts +11 -11
- package/runtime/guidance/index.js +11 -11
- package/runtime/guidance/outreach-draft-schema.d.ts +228 -228
- package/runtime/guidance/outreach-draft-schema.js +80 -80
- package/runtime/observability/audit/append-only-audit-store.d.ts +14 -14
- package/runtime/observability/audit/append-only-audit-store.js +21 -21
- package/runtime/observability/audit/audit-envelope.d.ts +51 -51
- package/runtime/observability/audit/audit-envelope.js +130 -130
- package/runtime/observability/audit/verify-audit-hash-chain.d.ts +23 -23
- package/runtime/observability/audit/verify-audit-hash-chain.js +83 -83
- package/runtime/observability/db/index.js +124 -124
- package/runtime/observability/db/schema/host-capability-reports.d.ts +180 -180
- package/runtime/observability/db/schema/host-capability-reports.js +12 -12
- package/runtime/observability/db/schema/index.d.ts +947 -947
- package/runtime/observability/db/schema/index.js +71 -71
- package/runtime/observability/index.d.ts +20 -19
- package/runtime/observability/index.js +19 -18
- package/runtime/observability/query/explain-query.d.ts +48 -48
- package/runtime/observability/query/explain-query.js +114 -114
- package/runtime/observability/query/export-audit-bundle.d.ts +22 -22
- package/runtime/observability/query/export-audit-bundle.js +27 -27
- package/runtime/observability/services/decision-ledger.d.ts +46 -46
- package/runtime/observability/services/decision-ledger.js +161 -161
- package/runtime/observability/services/governance-audit.d.ts +41 -41
- package/runtime/observability/services/governance-audit.js +163 -163
- package/runtime/observability/services/governance-plane-recorder.d.ts +47 -47
- package/runtime/observability/services/governance-plane-recorder.js +55 -55
- package/runtime/observability/services/lived-experience-audit.d.ts +97 -97
- package/runtime/observability/services/lived-experience-audit.js +162 -162
- package/runtime/observability/services/runtime-decision-recorder.d.ts +29 -0
- package/runtime/observability/services/runtime-decision-recorder.js +94 -0
- package/runtime/storage/bootstrap/native-sqlite-probe.d.ts +7 -7
- package/runtime/storage/bootstrap/native-sqlite-probe.js +28 -28
- package/runtime/storage/bootstrap/repair-gate.d.ts +17 -17
- package/runtime/storage/bootstrap/repair-gate.js +71 -71
- package/runtime/storage/bootstrap/storage-mode-smoke.d.ts +38 -38
- package/runtime/storage/bootstrap/storage-mode-smoke.js +85 -85
- package/runtime/storage/db/index.js +154 -154
- package/runtime/storage/db/schema/delivery-attempts.d.ts +199 -199
- package/runtime/storage/db/schema/delivery-attempts.js +13 -13
- package/runtime/storage/db/schema/index.d.ts +9 -9
- package/runtime/storage/db/schema/index.js +9 -9
- package/runtime/storage/db/schema/life-evidence-index.d.ts +161 -161
- package/runtime/storage/db/schema/life-evidence-index.js +11 -11
- package/runtime/storage/db/schema/operator-fallback-artifacts.d.ts +161 -161
- package/runtime/storage/db/schema/operator-fallback-artifacts.js +11 -11
- package/runtime/storage/db/schema/policies.d.ts +98 -98
- package/runtime/storage/db/schema/policies.js +8 -8
- package/runtime/storage/delivery/query-delivery-attempts.d.ts +3 -3
- package/runtime/storage/delivery/query-delivery-attempts.js +32 -32
- package/runtime/storage/delivery/types.d.ts +27 -27
- package/runtime/storage/delivery/types.js +1 -1
- package/runtime/storage/delivery/write-delivery-attempt.d.ts +6 -6
- package/runtime/storage/delivery/write-delivery-attempt.js +36 -36
- package/runtime/storage/fallback/load-operator-fallback.d.ts +14 -14
- package/runtime/storage/fallback/load-operator-fallback.js +47 -47
- package/runtime/storage/fallback/operator-fallback-types.d.ts +9 -9
- package/runtime/storage/fallback/operator-fallback-types.js +1 -1
- package/runtime/storage/fallback/operator-fallback-view.d.ts +11 -11
- package/runtime/storage/fallback/operator-fallback-view.js +1 -1
- package/runtime/storage/fallback/write-operator-fallback.d.ts +6 -6
- package/runtime/storage/fallback/write-operator-fallback.js +21 -21
- package/runtime/storage/index.d.ts +37 -37
- package/runtime/storage/index.js +30 -30
- package/runtime/storage/life-evidence/append-life-evidence.d.ts +7 -7
- package/runtime/storage/life-evidence/append-life-evidence.js +64 -64
- package/runtime/storage/life-evidence/types.d.ts +45 -45
- package/runtime/storage/life-evidence/types.js +6 -6
- package/runtime/storage/quiet/persist-quiet-artifact.d.ts +7 -7
- package/runtime/storage/quiet/persist-quiet-artifact.js +22 -22
- package/runtime/storage/quiet/quiet-artifact-types.d.ts +18 -18
- package/runtime/storage/quiet/quiet-artifact-types.js +1 -1
- package/runtime/storage/quiet/quiet-artifact-writer.d.ts +15 -15
- package/runtime/storage/quiet/quiet-artifact-writer.js +56 -56
- package/runtime/storage/repositories/credential-repository.js +30 -30
- package/runtime/storage/rhythm/rhythm-policy-snapshot.d.ts +10 -10
- package/runtime/storage/rhythm/rhythm-policy-snapshot.js +34 -34
- package/runtime/storage/services/credential-vault.d.ts +13 -13
- package/runtime/storage/services/credential-vault.js +116 -116
- package/runtime/storage/snapshots/continuity-snapshot.d.ts +9 -9
- package/runtime/storage/snapshots/continuity-snapshot.js +41 -41
- package/runtime/storage/snapshots/life-evidence-snapshot.d.ts +6 -6
- package/runtime/storage/snapshots/life-evidence-snapshot.js +114 -114
- package/runtime/storage/snapshots/types.d.ts +58 -58
- package/runtime/storage/snapshots/types.js +1 -1
- package/runtime/storage/state-api.js +104 -104
- package/runtime/storage/user-interest/load-user-interest-snapshot.d.ts +2 -2
- package/runtime/storage/user-interest/load-user-interest-snapshot.js +150 -150
- package/runtime/storage/user-interest/types.d.ts +25 -25
- package/runtime/storage/user-interest/types.js +1 -1
- package/workspace-ops-bridge.js +81 -80
package/openclaw.plugin.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "second-nature",
|
|
3
|
-
"name": "Second Nature",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"description": "OpenClaw native plugin with synchronous surface registration and bundled runtime spine. Set SECOND_NATURE_WORKSPACE_ROOT or tool workspaceRoot to the same path as the agent workspace (see README / T1.1.4 ops norm).",
|
|
6
|
-
"activation": {
|
|
7
|
-
"onStartup": true,
|
|
8
|
-
"onCapabilities": [
|
|
9
|
-
"tool"
|
|
10
|
-
]
|
|
11
|
-
},
|
|
12
|
-
"contracts": {
|
|
13
|
-
"commands": [
|
|
14
|
-
"second-nature"
|
|
15
|
-
],
|
|
16
|
-
"tools": [
|
|
17
|
-
"second_nature_ops"
|
|
18
|
-
],
|
|
19
|
-
"services": [
|
|
20
|
-
"second-nature-runtime",
|
|
21
|
-
"second-nature-lifecycle"
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
"configSchema": {
|
|
25
|
-
"type": "object",
|
|
26
|
-
"additionalProperties": false,
|
|
27
|
-
"properties": {}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "second-nature",
|
|
3
|
+
"name": "Second Nature",
|
|
4
|
+
"version": "0.1.18",
|
|
5
|
+
"description": "OpenClaw native plugin with synchronous surface registration and bundled runtime spine. Set SECOND_NATURE_WORKSPACE_ROOT or tool workspaceRoot to the same path as the agent workspace (see README / T1.1.4 ops norm).",
|
|
6
|
+
"activation": {
|
|
7
|
+
"onStartup": true,
|
|
8
|
+
"onCapabilities": [
|
|
9
|
+
"tool"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"contracts": {
|
|
13
|
+
"commands": [
|
|
14
|
+
"second-nature"
|
|
15
|
+
],
|
|
16
|
+
"tools": [
|
|
17
|
+
"second_nature_ops"
|
|
18
|
+
],
|
|
19
|
+
"services": [
|
|
20
|
+
"second-nature-runtime",
|
|
21
|
+
"second-nature-lifecycle"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"configSchema": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"additionalProperties": false,
|
|
27
|
+
"properties": {}
|
|
28
|
+
}
|
|
29
|
+
}
|
package/package.json
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@haaaiawd/second-nature",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "OpenClaw native plugin with synchronous registration, a packaged runtime artifact, and operator-facing status/explain flows.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"openclaw",
|
|
7
|
-
"plugin",
|
|
8
|
-
"agent",
|
|
9
|
-
"continuity",
|
|
10
|
-
"quiet",
|
|
11
|
-
"memory",
|
|
12
|
-
"observability",
|
|
13
|
-
"operator"
|
|
14
|
-
],
|
|
15
|
-
"license": "Apache-2.0",
|
|
16
|
-
"type": "module",
|
|
17
|
-
"main": "./index.js",
|
|
18
|
-
"files": [
|
|
19
|
-
"index.js",
|
|
20
|
-
"workspace-ops-bridge.js",
|
|
21
|
-
"openclaw.plugin.json",
|
|
22
|
-
"runtime/"
|
|
23
|
-
],
|
|
24
|
-
"publishConfig": {
|
|
25
|
-
"access": "public"
|
|
26
|
-
},
|
|
27
|
-
"openclaw": {
|
|
28
|
-
"manifest": "./openclaw.plugin.json",
|
|
29
|
-
"extensions": [
|
|
30
|
-
"./index.js"
|
|
31
|
-
],
|
|
32
|
-
"runtimeExtensions": [
|
|
33
|
-
"./index.js"
|
|
34
|
-
],
|
|
35
|
-
"compat": {
|
|
36
|
-
"pluginApi": ">=2026.5.4"
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"peerDependencies": {
|
|
40
|
-
"openclaw": ">=2026.5.4"
|
|
41
|
-
},
|
|
42
|
-
"peerDependenciesMeta": {
|
|
43
|
-
"openclaw": {
|
|
44
|
-
"optional": true
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"drizzle-orm": "^0.44.4",
|
|
49
|
-
"sql.js": "^1.14.1",
|
|
50
|
-
"zod": "^4.1.5"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@haaaiawd/second-nature",
|
|
3
|
+
"version": "0.1.18",
|
|
4
|
+
"description": "OpenClaw native plugin with synchronous registration, a packaged runtime artifact, and operator-facing status/explain flows.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"openclaw",
|
|
7
|
+
"plugin",
|
|
8
|
+
"agent",
|
|
9
|
+
"continuity",
|
|
10
|
+
"quiet",
|
|
11
|
+
"memory",
|
|
12
|
+
"observability",
|
|
13
|
+
"operator"
|
|
14
|
+
],
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "./index.js",
|
|
18
|
+
"files": [
|
|
19
|
+
"index.js",
|
|
20
|
+
"workspace-ops-bridge.js",
|
|
21
|
+
"openclaw.plugin.json",
|
|
22
|
+
"runtime/"
|
|
23
|
+
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"openclaw": {
|
|
28
|
+
"manifest": "./openclaw.plugin.json",
|
|
29
|
+
"extensions": [
|
|
30
|
+
"./index.js"
|
|
31
|
+
],
|
|
32
|
+
"runtimeExtensions": [
|
|
33
|
+
"./index.js"
|
|
34
|
+
],
|
|
35
|
+
"compat": {
|
|
36
|
+
"pluginApi": ">=2026.5.4"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"openclaw": ">=2026.5.4"
|
|
41
|
+
},
|
|
42
|
+
"peerDependenciesMeta": {
|
|
43
|
+
"openclaw": {
|
|
44
|
+
"optional": true
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"drizzle-orm": "^0.44.4",
|
|
49
|
+
"sql.js": "^1.14.1",
|
|
50
|
+
"zod": "^4.1.5"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { ActionBridge } from "../action-bridge.js";
|
|
2
|
-
import type { OpsRouter } from "../ops/ops-router.js";
|
|
3
|
-
import type { CliReadModels } from "../read-models/index.js";
|
|
4
|
-
export interface CliCommandDefinition {
|
|
5
|
-
name: string;
|
|
6
|
-
description: string;
|
|
7
|
-
execute(input?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
8
|
-
}
|
|
9
|
-
export interface CliCommandDeps {
|
|
10
|
-
readModels: CliReadModels;
|
|
11
|
-
actionBridge: ActionBridge;
|
|
12
|
-
opsRouter: OpsRouter;
|
|
13
|
-
}
|
|
14
|
-
export declare function createCliCommands(deps: CliCommandDeps): CliCommandDefinition[];
|
|
1
|
+
import type { ActionBridge } from "../action-bridge.js";
|
|
2
|
+
import type { OpsRouter } from "../ops/ops-router.js";
|
|
3
|
+
import type { CliReadModels } from "../read-models/index.js";
|
|
4
|
+
export interface CliCommandDefinition {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
execute(input?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
8
|
+
}
|
|
9
|
+
export interface CliCommandDeps {
|
|
10
|
+
readModels: CliReadModels;
|
|
11
|
+
actionBridge: ActionBridge;
|
|
12
|
+
opsRouter: OpsRouter;
|
|
13
|
+
}
|
|
14
|
+
export declare function createCliCommands(deps: CliCommandDeps): CliCommandDefinition[];
|
|
@@ -1,193 +1,193 @@
|
|
|
1
|
-
import { credentialVerify } from "./credential.js";
|
|
2
|
-
import { formatExplanation } from "../explain/format-explanation.js";
|
|
3
|
-
import { explainSurfaceSubject } from "../explain/explain-surface-subject.js";
|
|
4
|
-
import { showOperatorFallback, OperatorFallbackNotFoundError } from "../ops/show-operator-fallback.js";
|
|
5
|
-
import { runStorageModeSmoke } from "../../storage/bootstrap/storage-mode-smoke.js";
|
|
6
|
-
import { policySet } from "./policy.js";
|
|
7
|
-
const notImplemented = async (command) => ({
|
|
8
|
-
ok: false,
|
|
9
|
-
command,
|
|
10
|
-
message: "Command shell registered. Implementation lands in later Wave tasks.",
|
|
11
|
-
});
|
|
12
|
-
function explainSubjectError(code, message) {
|
|
13
|
-
return {
|
|
14
|
-
ok: false,
|
|
15
|
-
error: {
|
|
16
|
-
code,
|
|
17
|
-
message,
|
|
18
|
-
requiredUserInput: ["subject"],
|
|
19
|
-
nextStep: "reinvoke_explain_with_supported_subject",
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export function createCliCommands(deps) {
|
|
24
|
-
const { readModels, actionBridge, opsRouter } = deps;
|
|
25
|
-
return [
|
|
26
|
-
{
|
|
27
|
-
name: "status",
|
|
28
|
-
description: "Show aggregated Second Nature status",
|
|
29
|
-
execute: async (input) => {
|
|
30
|
-
const scope = typeof input?.scope === "string" ? input.scope : undefined;
|
|
31
|
-
const data = await readModels.loadStatus(scope);
|
|
32
|
-
return { ok: true, data };
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: "policy",
|
|
37
|
-
description: "Write or inspect policy state",
|
|
38
|
-
execute: async (input) => {
|
|
39
|
-
const action = typeof input?.action === "string" ? input.action : "show";
|
|
40
|
-
if (action === "set") {
|
|
41
|
-
return policySet(actionBridge, input);
|
|
42
|
-
}
|
|
43
|
-
return notImplemented("policy");
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "credential",
|
|
48
|
-
description: "Inspect or recover credential state",
|
|
49
|
-
execute: async (input) => {
|
|
50
|
-
const action = typeof input?.action === "string" ? input.action : "show";
|
|
51
|
-
if (action === "verify") {
|
|
52
|
-
return credentialVerify(actionBridge, input);
|
|
53
|
-
}
|
|
54
|
-
const platformId = typeof input?.platformId === "string" ? input.platformId : "unknown";
|
|
55
|
-
const data = await readModels.loadCredential(platformId);
|
|
56
|
-
return { ok: true, data };
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
name: "quiet",
|
|
61
|
-
description: "Inspect Quiet lifecycle state",
|
|
62
|
-
execute: async (input) => {
|
|
63
|
-
const scope = typeof input?.scope === "string" ? input.scope : undefined;
|
|
64
|
-
const data = await readModels.loadQuiet(scope);
|
|
65
|
-
return { ok: true, data };
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: "report",
|
|
70
|
-
description: "Show daily report artifacts",
|
|
71
|
-
execute: async (input) => {
|
|
72
|
-
const day = typeof input?.day === "string" ? input.day : new Date().toISOString().slice(0, 10);
|
|
73
|
-
const data = await readModels.loadDailyReport(day);
|
|
74
|
-
return { ok: true, data };
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: "session",
|
|
79
|
-
description: "Inspect continuity session details",
|
|
80
|
-
execute: async (input) => {
|
|
81
|
-
const sessionId = typeof input?.sessionId === "string" ? input.sessionId : "";
|
|
82
|
-
if (!sessionId) {
|
|
83
|
-
return {
|
|
84
|
-
ok: false,
|
|
85
|
-
error: {
|
|
86
|
-
code: "MISSING_SESSION_ID",
|
|
87
|
-
message: "session show requires sessionId",
|
|
88
|
-
requiredUserInput: ["session_id"],
|
|
89
|
-
nextStep: "reinvoke_session_with_session_id",
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
const data = await readModels.loadSession(sessionId);
|
|
94
|
-
return { ok: true, data };
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
name: "audit",
|
|
99
|
-
description: "Inspect audit and evidence views",
|
|
100
|
-
execute: () => notImplemented("audit"),
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: "explain",
|
|
104
|
-
description: "Answer why-question explain requests",
|
|
105
|
-
execute: async (input) => {
|
|
106
|
-
const subjectRaw = typeof input?.subject === "string" ? input.subject.trim() : "";
|
|
107
|
-
if (!subjectRaw) {
|
|
108
|
-
return {
|
|
109
|
-
ok: false,
|
|
110
|
-
error: {
|
|
111
|
-
code: "MISSING_EXPLAIN_SUBJECT",
|
|
112
|
-
message: "explain requires subject",
|
|
113
|
-
requiredUserInput: ["subject"],
|
|
114
|
-
nextStep: "reinvoke_explain_with_subject",
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
let model;
|
|
119
|
-
try {
|
|
120
|
-
model = await explainSurfaceSubject(subjectRaw, readModels);
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
const code = error.message;
|
|
124
|
-
if (code === "explain_subject_requires_id") {
|
|
125
|
-
return explainSubjectError("EXPLAIN_SUBJECT_REQUIRES_ID", "subject must include identifier");
|
|
126
|
-
}
|
|
127
|
-
if (code === "explain_subject_unsupported") {
|
|
128
|
-
return explainSubjectError("EXPLAIN_SUBJECT_UNSUPPORTED", "supported subjects include decision:, platform:, outreach:, soul:, fallback:, delivery:, probe:, report:, source:");
|
|
129
|
-
}
|
|
130
|
-
return explainSubjectError("EXPLAIN_SUBJECT_INVALID", "invalid explain subject");
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
ok: true,
|
|
134
|
-
data: formatExplanation(model),
|
|
135
|
-
};
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
name: "heartbeat_check",
|
|
140
|
-
description: "Workspace heartbeat_check ops surface (v5 HeartbeatSurfaceResult)",
|
|
141
|
-
execute: async (input) => {
|
|
142
|
-
const surface = await Promise.resolve(opsRouter.dispatch("heartbeat_check", input));
|
|
143
|
-
return surface;
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
name: "storage_smoke",
|
|
148
|
-
description: "T4.1.4 — report sql.js vs native SQLite probe and optional artifact→index repair fixture",
|
|
149
|
-
execute: async (input) => {
|
|
150
|
-
const runRepairFixture = Boolean(input?.runRepairFixture);
|
|
151
|
-
const workspaceRoot = typeof input?.workspaceRoot === "string" ? input.workspaceRoot : undefined;
|
|
152
|
-
const data = await runStorageModeSmoke({ runRepairFixture, workspaceRoot });
|
|
153
|
-
return { ok: true, data };
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: "fallback",
|
|
158
|
-
description: "Operator-visible delivery fallback view (status always not_sent)",
|
|
159
|
-
execute: async (input) => {
|
|
160
|
-
const ref = typeof input?.ref === "string" ? input.ref.trim() : "";
|
|
161
|
-
if (!ref) {
|
|
162
|
-
return {
|
|
163
|
-
ok: false,
|
|
164
|
-
error: {
|
|
165
|
-
code: "MISSING_FALLBACK_REF",
|
|
166
|
-
message: "fallback requires ref (e.g. fallback:…)",
|
|
167
|
-
requiredUserInput: ["ref"],
|
|
168
|
-
nextStep: "reinvoke_with_ref",
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
try {
|
|
173
|
-
const data = await showOperatorFallback(ref, readModels);
|
|
174
|
-
return { ok: true, data };
|
|
175
|
-
}
|
|
176
|
-
catch (error) {
|
|
177
|
-
if (error instanceof OperatorFallbackNotFoundError) {
|
|
178
|
-
return {
|
|
179
|
-
ok: false,
|
|
180
|
-
error: {
|
|
181
|
-
code: error.code,
|
|
182
|
-
message: error.message,
|
|
183
|
-
requiredUserInput: ["ref"],
|
|
184
|
-
nextStep: "verify_fallback_ref_from_delivery_audit",
|
|
185
|
-
},
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
throw error;
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
];
|
|
193
|
-
}
|
|
1
|
+
import { credentialVerify } from "./credential.js";
|
|
2
|
+
import { formatExplanation } from "../explain/format-explanation.js";
|
|
3
|
+
import { explainSurfaceSubject } from "../explain/explain-surface-subject.js";
|
|
4
|
+
import { showOperatorFallback, OperatorFallbackNotFoundError } from "../ops/show-operator-fallback.js";
|
|
5
|
+
import { runStorageModeSmoke } from "../../storage/bootstrap/storage-mode-smoke.js";
|
|
6
|
+
import { policySet } from "./policy.js";
|
|
7
|
+
const notImplemented = async (command) => ({
|
|
8
|
+
ok: false,
|
|
9
|
+
command,
|
|
10
|
+
message: "Command shell registered. Implementation lands in later Wave tasks.",
|
|
11
|
+
});
|
|
12
|
+
function explainSubjectError(code, message) {
|
|
13
|
+
return {
|
|
14
|
+
ok: false,
|
|
15
|
+
error: {
|
|
16
|
+
code,
|
|
17
|
+
message,
|
|
18
|
+
requiredUserInput: ["subject"],
|
|
19
|
+
nextStep: "reinvoke_explain_with_supported_subject",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function createCliCommands(deps) {
|
|
24
|
+
const { readModels, actionBridge, opsRouter } = deps;
|
|
25
|
+
return [
|
|
26
|
+
{
|
|
27
|
+
name: "status",
|
|
28
|
+
description: "Show aggregated Second Nature status",
|
|
29
|
+
execute: async (input) => {
|
|
30
|
+
const scope = typeof input?.scope === "string" ? input.scope : undefined;
|
|
31
|
+
const data = await readModels.loadStatus(scope);
|
|
32
|
+
return { ok: true, data };
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "policy",
|
|
37
|
+
description: "Write or inspect policy state",
|
|
38
|
+
execute: async (input) => {
|
|
39
|
+
const action = typeof input?.action === "string" ? input.action : "show";
|
|
40
|
+
if (action === "set") {
|
|
41
|
+
return policySet(actionBridge, input);
|
|
42
|
+
}
|
|
43
|
+
return notImplemented("policy");
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "credential",
|
|
48
|
+
description: "Inspect or recover credential state",
|
|
49
|
+
execute: async (input) => {
|
|
50
|
+
const action = typeof input?.action === "string" ? input.action : "show";
|
|
51
|
+
if (action === "verify") {
|
|
52
|
+
return credentialVerify(actionBridge, input);
|
|
53
|
+
}
|
|
54
|
+
const platformId = typeof input?.platformId === "string" ? input.platformId : "unknown";
|
|
55
|
+
const data = await readModels.loadCredential(platformId);
|
|
56
|
+
return { ok: true, data };
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "quiet",
|
|
61
|
+
description: "Inspect Quiet lifecycle state",
|
|
62
|
+
execute: async (input) => {
|
|
63
|
+
const scope = typeof input?.scope === "string" ? input.scope : undefined;
|
|
64
|
+
const data = await readModels.loadQuiet(scope);
|
|
65
|
+
return { ok: true, data };
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "report",
|
|
70
|
+
description: "Show daily report artifacts",
|
|
71
|
+
execute: async (input) => {
|
|
72
|
+
const day = typeof input?.day === "string" ? input.day : new Date().toISOString().slice(0, 10);
|
|
73
|
+
const data = await readModels.loadDailyReport(day);
|
|
74
|
+
return { ok: true, data };
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "session",
|
|
79
|
+
description: "Inspect continuity session details",
|
|
80
|
+
execute: async (input) => {
|
|
81
|
+
const sessionId = typeof input?.sessionId === "string" ? input.sessionId : "";
|
|
82
|
+
if (!sessionId) {
|
|
83
|
+
return {
|
|
84
|
+
ok: false,
|
|
85
|
+
error: {
|
|
86
|
+
code: "MISSING_SESSION_ID",
|
|
87
|
+
message: "session show requires sessionId",
|
|
88
|
+
requiredUserInput: ["session_id"],
|
|
89
|
+
nextStep: "reinvoke_session_with_session_id",
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const data = await readModels.loadSession(sessionId);
|
|
94
|
+
return { ok: true, data };
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "audit",
|
|
99
|
+
description: "Inspect audit and evidence views",
|
|
100
|
+
execute: () => notImplemented("audit"),
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "explain",
|
|
104
|
+
description: "Answer why-question explain requests",
|
|
105
|
+
execute: async (input) => {
|
|
106
|
+
const subjectRaw = typeof input?.subject === "string" ? input.subject.trim() : "";
|
|
107
|
+
if (!subjectRaw) {
|
|
108
|
+
return {
|
|
109
|
+
ok: false,
|
|
110
|
+
error: {
|
|
111
|
+
code: "MISSING_EXPLAIN_SUBJECT",
|
|
112
|
+
message: "explain requires subject",
|
|
113
|
+
requiredUserInput: ["subject"],
|
|
114
|
+
nextStep: "reinvoke_explain_with_subject",
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
let model;
|
|
119
|
+
try {
|
|
120
|
+
model = await explainSurfaceSubject(subjectRaw, readModels);
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
const code = error.message;
|
|
124
|
+
if (code === "explain_subject_requires_id") {
|
|
125
|
+
return explainSubjectError("EXPLAIN_SUBJECT_REQUIRES_ID", "subject must include identifier");
|
|
126
|
+
}
|
|
127
|
+
if (code === "explain_subject_unsupported") {
|
|
128
|
+
return explainSubjectError("EXPLAIN_SUBJECT_UNSUPPORTED", "supported subjects include decision:, platform:, outreach:, soul:, fallback:, delivery:, probe:, report:, source:");
|
|
129
|
+
}
|
|
130
|
+
return explainSubjectError("EXPLAIN_SUBJECT_INVALID", "invalid explain subject");
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
ok: true,
|
|
134
|
+
data: formatExplanation(model),
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "heartbeat_check",
|
|
140
|
+
description: "Workspace heartbeat_check ops surface (v5 HeartbeatSurfaceResult)",
|
|
141
|
+
execute: async (input) => {
|
|
142
|
+
const surface = await Promise.resolve(opsRouter.dispatch("heartbeat_check", input));
|
|
143
|
+
return surface;
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "storage_smoke",
|
|
148
|
+
description: "T4.1.4 — report sql.js vs native SQLite probe and optional artifact→index repair fixture",
|
|
149
|
+
execute: async (input) => {
|
|
150
|
+
const runRepairFixture = Boolean(input?.runRepairFixture);
|
|
151
|
+
const workspaceRoot = typeof input?.workspaceRoot === "string" ? input.workspaceRoot : undefined;
|
|
152
|
+
const data = await runStorageModeSmoke({ runRepairFixture, workspaceRoot });
|
|
153
|
+
return { ok: true, data };
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: "fallback",
|
|
158
|
+
description: "Operator-visible delivery fallback view (status always not_sent)",
|
|
159
|
+
execute: async (input) => {
|
|
160
|
+
const ref = typeof input?.ref === "string" ? input.ref.trim() : "";
|
|
161
|
+
if (!ref) {
|
|
162
|
+
return {
|
|
163
|
+
ok: false,
|
|
164
|
+
error: {
|
|
165
|
+
code: "MISSING_FALLBACK_REF",
|
|
166
|
+
message: "fallback requires ref (e.g. fallback:…)",
|
|
167
|
+
requiredUserInput: ["ref"],
|
|
168
|
+
nextStep: "reinvoke_with_ref",
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
try {
|
|
173
|
+
const data = await showOperatorFallback(ref, readModels);
|
|
174
|
+
return { ok: true, data };
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
if (error instanceof OperatorFallbackNotFoundError) {
|
|
178
|
+
return {
|
|
179
|
+
ok: false,
|
|
180
|
+
error: {
|
|
181
|
+
code: error.code,
|
|
182
|
+
message: error.message,
|
|
183
|
+
requiredUserInput: ["ref"],
|
|
184
|
+
nextStep: "verify_fallback_ref_from_delivery_audit",
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
throw error;
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
];
|
|
193
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stable operator explain entry matching cli-system.detail §3.8 (T1.2.1).
|
|
3
|
-
*
|
|
4
|
-
* Core logic: parse subject string via resolveExplainSubject, delegate to read models.
|
|
5
|
-
*/
|
|
6
|
-
import type { CliReadModels } from "../read-models/index.js";
|
|
7
|
-
import type { ExplainReadModel } from "../read-models/types.js";
|
|
8
|
-
export declare function explainSurfaceSubject(subjectRaw: string, readModels: CliReadModels): Promise<ExplainReadModel>;
|
|
1
|
+
/**
|
|
2
|
+
* Stable operator explain entry matching cli-system.detail §3.8 (T1.2.1).
|
|
3
|
+
*
|
|
4
|
+
* Core logic: parse subject string via resolveExplainSubject, delegate to read models.
|
|
5
|
+
*/
|
|
6
|
+
import type { CliReadModels } from "../read-models/index.js";
|
|
7
|
+
import type { ExplainReadModel } from "../read-models/types.js";
|
|
8
|
+
export declare function explainSurfaceSubject(subjectRaw: string, readModels: CliReadModels): Promise<ExplainReadModel>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { resolveExplainSubject } from "./resolve-subject.js";
|
|
2
|
-
export async function explainSurfaceSubject(subjectRaw, readModels) {
|
|
3
|
-
const trimmed = subjectRaw.trim();
|
|
4
|
-
if (!trimmed) {
|
|
5
|
-
throw new Error("explain_subject_requires_id");
|
|
6
|
-
}
|
|
7
|
-
const subject = resolveExplainSubject(trimmed);
|
|
8
|
-
return readModels.explain(subject);
|
|
9
|
-
}
|
|
1
|
+
import { resolveExplainSubject } from "./resolve-subject.js";
|
|
2
|
+
export async function explainSurfaceSubject(subjectRaw, readModels) {
|
|
3
|
+
const trimmed = subjectRaw.trim();
|
|
4
|
+
if (!trimmed) {
|
|
5
|
+
throw new Error("explain_subject_requires_id");
|
|
6
|
+
}
|
|
7
|
+
const subject = resolveExplainSubject(trimmed);
|
|
8
|
+
return readModels.explain(subject);
|
|
9
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { ExplainReadModel } from "../read-models/types.js";
|
|
2
|
-
export interface FormattedExplanation {
|
|
3
|
-
subjectType: ExplainReadModel["subjectType"];
|
|
4
|
-
conclusion: string;
|
|
5
|
-
keyFactors: string[];
|
|
6
|
-
evidenceRefs: string[];
|
|
7
|
-
requiredUserInput?: string[];
|
|
8
|
-
nextStep?: string;
|
|
9
|
-
warnings?: string[];
|
|
10
|
-
relatedAuditEventIds?: string[];
|
|
11
|
-
}
|
|
12
|
-
export declare function formatExplanation(model: ExplainReadModel): FormattedExplanation;
|
|
1
|
+
import type { ExplainReadModel } from "../read-models/types.js";
|
|
2
|
+
export interface FormattedExplanation {
|
|
3
|
+
subjectType: ExplainReadModel["subjectType"];
|
|
4
|
+
conclusion: string;
|
|
5
|
+
keyFactors: string[];
|
|
6
|
+
evidenceRefs: string[];
|
|
7
|
+
requiredUserInput?: string[];
|
|
8
|
+
nextStep?: string;
|
|
9
|
+
warnings?: string[];
|
|
10
|
+
relatedAuditEventIds?: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare function formatExplanation(model: ExplainReadModel): FormattedExplanation;
|