@rubytech/create-realagent-code 0.1.29 → 0.1.31
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/dist/__tests__/init-logging.test.js +85 -0
- package/dist/index.js +21 -10
- package/dist/init-logging.js +28 -0
- package/package.json +1 -1
- package/payload/platform/lib/persistent-components/dist/index.d.ts +11 -12
- package/payload/platform/lib/persistent-components/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/persistent-components/dist/index.js +11 -12
- package/payload/platform/lib/persistent-components/dist/index.js.map +1 -1
- package/payload/platform/lib/persistent-components/src/index.ts +11 -12
- package/payload/platform/neo4j/schema.cypher +6 -3
- package/payload/platform/plugins/admin/.claude-plugin/plugin.json +1 -1
- package/payload/platform/plugins/admin/PLUGIN.md +1 -3
- package/payload/platform/plugins/admin/hooks/onboarding-skill-drift.sh +57 -54
- package/payload/platform/plugins/admin/mcp/dist/index.js +15 -50
- package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/admin/skills/access-manager/references/operations.md +7 -7
- package/payload/platform/plugins/admin/skills/file-presentation/SKILL.md +16 -33
- package/payload/platform/plugins/admin/skills/plugin-management/SKILL.md +1 -1
- package/payload/platform/plugins/admin/skills/public-agent-manager/SKILL.md +2 -2
- package/payload/platform/plugins/admin/skills/stream-log-review/references/analysis-patterns.md +2 -2
- package/payload/platform/plugins/anthropic/skills/get-api-key/SKILL.md +2 -4
- package/payload/platform/plugins/brochures/PLUGIN.md +1 -1
- package/payload/platform/plugins/buyers/PLUGIN.md +1 -2
- package/payload/platform/plugins/deep-research/skills/book-mirror/SKILL.md +1 -1
- package/payload/platform/plugins/deep-research/skills/strategic-reading/SKILL.md +1 -1
- package/payload/platform/plugins/docs/references/plugins-guide.md +2 -2
- package/payload/platform/plugins/email/references/email-reference.md +3 -7
- package/payload/platform/plugins/estate-business/PLUGIN.md +1 -2
- package/payload/platform/plugins/estate-coaching/PLUGIN.md +1 -2
- package/payload/platform/plugins/estate-onboarding/PLUGIN.md +1 -2
- package/payload/platform/plugins/estate-sales/PLUGIN.md +1 -2
- package/payload/platform/plugins/estate-teaching/PLUGIN.md +1 -2
- package/payload/platform/plugins/leads/PLUGIN.md +1 -2
- package/payload/platform/plugins/listings/PLUGIN.md +1 -2
- package/payload/platform/plugins/loop/PLUGIN.md +1 -1
- package/payload/platform/plugins/scheduling/PLUGIN.md +1 -1
- package/payload/platform/plugins/teaching/PLUGIN.md +2 -1
- package/payload/platform/plugins/vendors/PLUGIN.md +1 -2
- package/payload/platform/plugins/whatsapp/mcp/dist/index.js +1 -1
- package/payload/platform/plugins/whatsapp/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/whatsapp/skills/connect-whatsapp/SKILL.md +1 -1
- package/payload/platform/plugins/whatsapp/skills/manage-whatsapp-config/SKILL.md +2 -8
- package/payload/platform/plugins/writer-craft/PLUGIN.md +2 -1
- package/payload/platform/scripts/component-knowledgedoc-backfill.ts +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.d.ts +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.js +45 -31
- package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/index.js +11 -0
- package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-observer.d.ts +30 -0
- package/payload/platform/services/claude-session-manager/dist/jsonl-observer.d.ts.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/jsonl-observer.js +175 -0
- package/payload/platform/services/claude-session-manager/dist/jsonl-observer.js.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/jsonl-path.d.ts +4 -2
- package/payload/platform/services/claude-session-manager/dist/jsonl-path.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-path.js +15 -22
- package/payload/platform/services/claude-session-manager/dist/jsonl-path.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +13 -0
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +26 -4
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/session-store.d.ts +9 -0
- package/payload/platform/services/claude-session-manager/dist/session-store.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/session-store.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/system-prompt.d.ts +10 -7
- package/payload/platform/services/claude-session-manager/dist/system-prompt.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/system-prompt.js +51 -28
- package/payload/platform/services/claude-session-manager/dist/system-prompt.js.map +1 -1
- package/payload/platform/services/claude-session-manager/scripts/onboarding-advance.sh +61 -0
- package/payload/platform/services/claude-session-manager/scripts/onboarding-prompts/step-0.md +5 -0
- package/payload/platform/services/claude-session-manager/scripts/onboarding-prompts/step-1.md +3 -0
- package/payload/platform/services/claude-session-manager/scripts/onboarding-prompts/step-2.md +3 -0
- package/payload/platform/services/claude-session-manager/scripts/onboarding-prompts/step-3.md +8 -0
- package/payload/platform/services/claude-session-manager/scripts/onboarding-prompts/step-4.md +9 -0
- package/payload/platform/services/claude-session-manager/scripts/onboarding-prompts/step-5.md +3 -0
- package/payload/platform/services/claude-session-manager/scripts/onboarding-prompts/step-6.md +5 -0
- package/payload/platform/services/claude-session-manager/scripts/onboarding-prompts/step-7.md +5 -0
- package/payload/platform/services/claude-session-manager/scripts/onboarding-prompts/step-8.md +5 -0
- package/payload/platform/services/claude-session-manager/scripts/onboarding-prompts/step-9.md +8 -0
- package/payload/platform/services/claude-session-manager/scripts/onboarding-prompts/step-complete.md +3 -0
- package/payload/platform/services/claude-session-manager/scripts/onboarding-prompts/step-unreachable.md +3 -0
- package/payload/platform/templates/agents/public/IDENTITY.md +1 -1
- package/payload/platform/templates/specialists/agents/content-producer.md +3 -3
- package/payload/platform/templates/specialists/agents/personal-assistant.md +2 -2
- package/payload/premium-plugins/real-agent/BUNDLE.md +5 -5
- package/payload/premium-plugins/real-agent/agents/compliance.md +1 -1
- package/payload/premium-plugins/real-agent/agents/negotiator.md +1 -1
- package/payload/premium-plugins/real-agent/agents/valuer.md +1 -1
- package/payload/premium-plugins/real-agent/plugins/brochures/PLUGIN.md +1 -1
- package/payload/premium-plugins/real-agent/plugins/buyers/PLUGIN.md +1 -2
- package/payload/premium-plugins/real-agent/plugins/estate-business/PLUGIN.md +1 -2
- package/payload/premium-plugins/real-agent/plugins/estate-coaching/PLUGIN.md +1 -2
- package/payload/premium-plugins/real-agent/plugins/estate-onboarding/PLUGIN.md +1 -2
- package/payload/premium-plugins/real-agent/plugins/estate-sales/PLUGIN.md +1 -2
- package/payload/premium-plugins/real-agent/plugins/estate-teaching/PLUGIN.md +1 -2
- package/payload/premium-plugins/real-agent/plugins/leads/PLUGIN.md +1 -2
- package/payload/premium-plugins/real-agent/plugins/listings/PLUGIN.md +1 -2
- package/payload/premium-plugins/real-agent/plugins/loop/PLUGIN.md +1 -1
- package/payload/premium-plugins/real-agent/plugins/vendors/PLUGIN.md +1 -2
- package/payload/premium-plugins/teaching/PLUGIN.md +2 -1
- package/payload/premium-plugins/writer-craft/PLUGIN.md +2 -1
- package/payload/server/public/assets/{admin-CDvF5de6.js → admin-Bk2eXMFD.js} +24 -24
- package/payload/server/public/assets/{data-K_kS__sL.js → data-ll_OwVNL.js} +1 -1
- package/payload/server/public/assets/{graph-DeEigyO_.js → graph-DJ2VWioQ.js} +1 -1
- package/payload/server/public/assets/graph-labels-qhU8xZDH.js +1 -0
- package/payload/server/public/assets/{page-qSH972X0.js → page-Dk73ZO1F.js} +1 -1
- package/payload/server/public/assets/{page-B_rpjIRr.js → page-DsYsdBUK.js} +1 -1
- package/payload/server/public/data.html +3 -3
- package/payload/server/public/graph.html +3 -3
- package/payload/server/public/index.html +4 -4
- package/payload/server/server.js +121 -46
- package/payload/platform/plugins/admin/references/contextual-ui.md +0 -107
- package/payload/platform/scripts/__tests__/admin-persist-audit.test.ts +0 -182
- package/payload/server/public/assets/graph-labels-C7I5QvNv.js +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare function claudeStateRoot(env?: NodeJS.ProcessEnv): string;
|
|
2
2
|
export declare function projectSlugForCwd(cwd: string): string;
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/** Extract the bridge-session suffix from a `/remote-control` URL. This is
|
|
4
|
+
* the part after `session_`, not the intrinsic JSONL filename. Returns
|
|
5
|
+
* null if the URL has no `session_<...>` component. */
|
|
6
|
+
export declare function bridgeSuffixFromUrl(url: string): string | null;
|
|
5
7
|
//# sourceMappingURL=jsonl-path.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl-path.d.ts","sourceRoot":"","sources":["../src/jsonl-path.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jsonl-path.d.ts","sourceRoot":"","sources":["../src/jsonl-path.ts"],"names":[],"mappings":"AAqBA,wBAAgB,eAAe,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAE5E;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;wDAEwD;AACxD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG9D"}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Helpers for locating claude's per-session JSONL transcripts on disk.
|
|
2
2
|
//
|
|
3
3
|
// Claude Code writes one JSONL file per session at
|
|
4
4
|
//
|
|
5
5
|
// ${CLAUDE_CONFIG_DIR or ~/.claude}/projects/<project-slug>/<claude-session-id>.jsonl
|
|
6
6
|
//
|
|
7
|
-
// where <project-slug> is the cwd at spawn time with every '/' replaced
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
7
|
+
// where <project-slug> is the cwd at spawn time with every '/' replaced by '-'
|
|
8
|
+
// (leading slash included, so /home/foo becomes -home-foo). Task 019 set
|
|
9
|
+
// CLAUDE_CONFIG_DIR on the manager unit so brand isolation holds for
|
|
10
|
+
// credentials, onboarding state, and JSONL transcripts.
|
|
11
11
|
//
|
|
12
|
-
// Task
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
// The PRD names this file as the canonical per-session forensic surface;
|
|
19
|
-
// the manager records the path on every spawn so the operator can
|
|
20
|
-
// `tail -f` it directly.
|
|
12
|
+
// Task 065 removed `deriveJsonlPath` and `claudeSessionIdFromUrl`. The
|
|
13
|
+
// `/remote-control` URL contains the bridge sessionId (the suffix after
|
|
14
|
+
// `session_`), which is NOT the JSONL filename. The intrinsic JSONL
|
|
15
|
+
// filename is only knowable by observing what Claude Code actually writes
|
|
16
|
+
// on disk (see `jsonl-observer.ts`). The only URL helper still needed is
|
|
17
|
+
// `bridgeSuffixFromUrl`, used by pty-spawner to register the observation.
|
|
21
18
|
import { homedir } from 'node:os';
|
|
22
19
|
import { join } from 'node:path';
|
|
23
20
|
export function claudeStateRoot(env = process.env) {
|
|
@@ -26,15 +23,11 @@ export function claudeStateRoot(env = process.env) {
|
|
|
26
23
|
export function projectSlugForCwd(cwd) {
|
|
27
24
|
return cwd.replace(/\//g, '-');
|
|
28
25
|
}
|
|
29
|
-
|
|
26
|
+
/** Extract the bridge-session suffix from a `/remote-control` URL. This is
|
|
27
|
+
* the part after `session_`, not the intrinsic JSONL filename. Returns
|
|
28
|
+
* null if the URL has no `session_<...>` component. */
|
|
29
|
+
export function bridgeSuffixFromUrl(url) {
|
|
30
30
|
const match = url.match(/session_([A-Za-z0-9_-]+)/);
|
|
31
31
|
return match ? match[1] : null;
|
|
32
32
|
}
|
|
33
|
-
export function deriveJsonlPath(cwd, url) {
|
|
34
|
-
const claudeId = claudeSessionIdFromUrl(url);
|
|
35
|
-
if (!claudeId)
|
|
36
|
-
return null;
|
|
37
|
-
const slug = projectSlugForCwd(cwd);
|
|
38
|
-
return join(claudeStateRoot(), 'projects', slug, `${claudeId}.jsonl`);
|
|
39
|
-
}
|
|
40
33
|
//# sourceMappingURL=jsonl-path.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl-path.js","sourceRoot":"","sources":["../src/jsonl-path.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"jsonl-path.js","sourceRoot":"","sources":["../src/jsonl-path.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,mDAAmD;AACnD,EAAE;AACF,0FAA0F;AAC1F,EAAE;AACF,+EAA+E;AAC/E,yEAAyE;AACzE,qEAAqE;AACrE,wDAAwD;AACxD,EAAE;AACF,uEAAuE;AACvE,wEAAwE;AACxE,oEAAoE;AACpE,0EAA0E;AAC1E,yEAAyE;AACzE,0EAA0E;AAE1E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,UAAU,eAAe,CAAC,MAAyB,OAAO,CAAC,GAAG;IAClE,OAAO,GAAG,CAAC,iBAAiB,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAA;AAC5D,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AAChC,CAAC;AAED;;wDAEwD;AACxD,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAA;IACnD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAChC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Logger, PtyHandle, Role, Channel } from './types.js';
|
|
2
2
|
import { SessionStore, type StoredSession } from './session-store.js';
|
|
3
|
+
import type { JsonlObserver } from './jsonl-observer.js';
|
|
3
4
|
import { type OnboardingPayload } from './system-prompt.js';
|
|
4
5
|
import type { HostResolution } from './config.js';
|
|
5
6
|
import type { ToolSurface } from './tool-surface.js';
|
|
@@ -31,6 +32,18 @@ export interface SpawnDeps {
|
|
|
31
32
|
* publicAllowlist field, so by the time pty-spawner sees this struct, the
|
|
32
33
|
* per-tool decisions are guaranteed complete. */
|
|
33
34
|
toolSurface: ToolSurface;
|
|
35
|
+
/** Task 065 — observer for the JSONL file Claude Code writes. The spawn
|
|
36
|
+
* registers a pending observation keyed on the URL's bridge suffix; the
|
|
37
|
+
* observer resolves when the matching JSONL appears on disk. Tests
|
|
38
|
+
* inject a noop observer whose `observe()` returns a never-resolving
|
|
39
|
+
* promise and a no-op cancel. */
|
|
40
|
+
observer: JsonlObserver;
|
|
41
|
+
/** Task 065 — fires once after the observer matches a JSONL to the
|
|
42
|
+
* session. The closure has already mutated `session.jsonlPath` and
|
|
43
|
+
* `session.claudeSessionId` by the time this is invoked. http-server
|
|
44
|
+
* uses this to defer public-tool audit attachment until the JSONL
|
|
45
|
+
* exists. Tests may omit this. */
|
|
46
|
+
onJsonlObserved?: (session: StoredSession) => void;
|
|
34
47
|
}
|
|
35
48
|
export interface SpawnArgs {
|
|
36
49
|
senderId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pty-spawner.d.ts","sourceRoot":"","sources":["../src/pty-spawner.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAElE,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAErE,OAAO,EAAoD,KAAK,iBAAiB,EAAE,MAAM,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;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,CAAA;AACxE,eAAO,MAAM,gBAAgB,EAAE,SAAS,cAAc,EAA+C,CAAA;AAErG,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CA+I/F;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,YAAY,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,aAAa,CACjC,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAqBzC"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { randomUUID } from 'node:crypto';
|
|
12
12
|
import { mkdirSync } from 'node:fs';
|
|
13
13
|
import { startUrlCapture } from './url-capture.js';
|
|
14
|
-
import {
|
|
14
|
+
import { bridgeSuffixFromUrl } from './jsonl-path.js';
|
|
15
15
|
import { composeAppendSystemPrompt, renderOnboardingBlock } from './system-prompt.js';
|
|
16
16
|
export const PERMISSION_MODES = ['default', 'acceptEdits', 'plan', 'auto'];
|
|
17
17
|
export async function spawnClaudeSession(deps, args) {
|
|
@@ -87,7 +87,10 @@ export async function spawnClaudeSession(deps, args) {
|
|
|
87
87
|
timeoutMs: deps.urlCaptureTimeoutMs,
|
|
88
88
|
logger: deps.logger,
|
|
89
89
|
onUrl: (url) => {
|
|
90
|
-
|
|
90
|
+
// Task 065 — never predict the JSONL path. Store the session with
|
|
91
|
+
// null observation fields; the observer mutates them once Claude
|
|
92
|
+
// Code's file appears on disk and the head bytes match this
|
|
93
|
+
// spawn's bridge suffix.
|
|
91
94
|
const session = {
|
|
92
95
|
sessionId,
|
|
93
96
|
pid: pty.pid,
|
|
@@ -96,16 +99,35 @@ export async function spawnClaudeSession(deps, args) {
|
|
|
96
99
|
senderId: args.senderId,
|
|
97
100
|
role: args.role,
|
|
98
101
|
channel: args.channel,
|
|
99
|
-
jsonlPath,
|
|
102
|
+
jsonlPath: null,
|
|
103
|
+
claudeSessionId: null,
|
|
100
104
|
pty,
|
|
101
105
|
exited: false,
|
|
102
106
|
};
|
|
103
107
|
deps.store.add(session);
|
|
108
|
+
const bridgeSuffix = bridgeSuffixFromUrl(url);
|
|
109
|
+
let observation = null;
|
|
110
|
+
if (bridgeSuffix) {
|
|
111
|
+
observation = deps.observer.observe({ bridgeSuffix });
|
|
112
|
+
observation.promise.then((observed) => {
|
|
113
|
+
if (!observed)
|
|
114
|
+
return;
|
|
115
|
+
session.jsonlPath = observed.jsonlPath;
|
|
116
|
+
session.claudeSessionId = observed.claudeSessionId;
|
|
117
|
+
deps.logger(`jsonl-observed pid=${pty.pid} sessionId=${observed.claudeSessionId} path=${observed.jsonlPath}`);
|
|
118
|
+
deps.onJsonlObserved?.(session);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
deps.logger(`jsonl-observe-skipped pid=${pty.pid} reason=bridge-suffix-unparseable url=${url}`);
|
|
123
|
+
}
|
|
104
124
|
pty.onExit(() => {
|
|
105
125
|
session.exited = true;
|
|
126
|
+
if (observation)
|
|
127
|
+
observation.cancel();
|
|
106
128
|
deps.logger(`kill pid=${pty.pid} reason=process-exited exit-code=0`);
|
|
107
129
|
});
|
|
108
|
-
deps.logger(`spawn pid=${pty.pid} sessionUrl=${url}
|
|
130
|
+
deps.logger(`spawn pid=${pty.pid} sessionUrl=${url} senderId=${args.senderId} role=${args.role} channel=${args.channel} permissionMode=${args.permissionMode ?? 'default'} latency-ms=${Date.now() - start}`);
|
|
109
131
|
deps.logger(`[pty-spawn] sessionId=${sessionId} appendSystemPromptBytes=${Buffer.byteLength(appendSystemPrompt, 'utf8')} hostname=${deps.host.hostname} lanIPv4=${deps.host.lanIPv4} adminUrl=${deps.host.adminUrl} tunnelUrl=${deps.host.tunnelUrl ?? 'none'}`);
|
|
110
132
|
if (args.onboarding) {
|
|
111
133
|
const rendered = renderOnboardingBlock(args.onboarding.step);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pty-spawner.js","sourceRoot":"","sources":["../src/pty-spawner.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,yEAAyE;AACzE,0DAA0D;AAC1D,0EAA0E;AAC1E,2EAA2E;AAC3E,eAAe;AACf,EAAE;AACF,0EAA0E;AAC1E,0EAA0E;AAC1E,iEAAiE;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"pty-spawner.js","sourceRoot":"","sources":["../src/pty-spawner.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,yEAAyE;AACzE,0DAA0D;AAC1D,0EAA0E;AAC1E,2EAA2E;AAC3E,eAAe;AACf,EAAE;AACF,0EAA0E;AAC1E,0EAA0E;AAC1E,iEAAiE;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAA0B,MAAM,oBAAoB,CAAA;AA6F7G,MAAM,CAAC,MAAM,gBAAgB,GAA8B,CAAC,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAErG,MAAM,CAAC,KAAK,UAAU,kBAAkB,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C,CAAC,CAAA;IACpE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;AACpC,CAAC"}
|
|
@@ -7,7 +7,16 @@ export interface StoredSession {
|
|
|
7
7
|
senderId: string;
|
|
8
8
|
role: Role;
|
|
9
9
|
channel: Channel;
|
|
10
|
+
/** Path to the JSONL Claude Code wrote, observed from disk (see
|
|
11
|
+
* jsonl-observer.ts). Null until the observer matches the JSONL to
|
|
12
|
+
* this session's bridge suffix. Task 065 — replaces the predicted
|
|
13
|
+
* path that produced phantom /list rows. */
|
|
10
14
|
jsonlPath: string | null;
|
|
15
|
+
/** Intrinsic claude session id (the JSONL basename, without `.jsonl`),
|
|
16
|
+
* observed via jsonl-observer. Distinct from the URL bridge suffix.
|
|
17
|
+
* Used by /list dedup against the on-disk enumerator. Null until the
|
|
18
|
+
* observer fires. Task 065. */
|
|
19
|
+
claudeSessionId: string | null;
|
|
11
20
|
pty: PtyHandle;
|
|
12
21
|
exited: boolean;
|
|
13
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../src/session-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE1D,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,GAAG,EAAE,SAAS,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmC;IAE5D,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1 @@
|
|
|
1
|
-
{"version":3,"file":"session-store.js","sourceRoot":"","sources":["../src/session-store.ts"],"names":[],"mappings":"AAAA,6EAA6E;
|
|
1
|
+
{"version":3,"file":"session-store.js","sourceRoot":"","sources":["../src/session-store.ts"],"names":[],"mappings":"AAAA,6EAA6E;AA0B7E,MAAM,OAAO,YAAY;IACN,QAAQ,GAAG,IAAI,GAAG,EAAyB,CAAA;IAE5D,GAAG,CAAC,CAAgB;QAClB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;IACnC,CAAC;IAED,GAAG,CAAC,EAAU;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC9B,CAAC;IAED,MAAM,CAAC,EAAU;QACf,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QAC/B,IAAI,CAAC;YAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QAC/B,OAAO,CAAC,CAAA;IACV,CAAC;IAED,YAAY,CAAC,QAAgB;QAC3B,MAAM,GAAG,GAAoB,EAAE,CAAA;QAC/B,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YACvC,IAAI,CAAC,CAAC,QAAQ,KAAK,QAAQ;gBAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAC1C,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,GAAG;QACD,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;IACpC,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAA;IAC3B,CAAC;CACF"}
|
|
@@ -8,11 +8,13 @@ export interface HostContext {
|
|
|
8
8
|
* `step` is the raw value returned by `loadOnboardingStep(accountId)` —
|
|
9
9
|
* 0..8 = in-progress, 9 = complete, -1 = no node (defensive), null =
|
|
10
10
|
* Neo4j unreachable. Task 043 moves the onboarding directive from PTY
|
|
11
|
-
* keystrokes
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* keystrokes into the spawn-time append-system-prompt block. Task 066
|
|
12
|
+
* makes the block state-only and adds the optional `resumePrompt` —
|
|
13
|
+
* verbatim stdout of the banner-click script run that the operator
|
|
14
|
+
* just saw in the chat surface. */
|
|
14
15
|
export interface OnboardingPayload {
|
|
15
16
|
step: number | null;
|
|
17
|
+
resumePrompt?: string;
|
|
16
18
|
}
|
|
17
19
|
export declare const ATTACHMENT_CEILING_BYTES = 31457280;
|
|
18
20
|
export declare function composeAppendSystemPrompt(host: HostContext, onboarding?: OnboardingPayload): string | null;
|
|
@@ -26,8 +28,9 @@ export interface RenderedOnboardingBlock {
|
|
|
26
28
|
}
|
|
27
29
|
/** Render the onboarding-state section for a given step. Returns null when
|
|
28
30
|
* the agent should see no onboarding block (step === 9 = complete). The
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
|
|
31
|
+
* body is state-only per Task 066: currentStep + resumeStep attributes
|
|
32
|
+
* plus an optional `<resume-prompt-shown>` child carrying the verbatim
|
|
33
|
+
* output of the banner-click script run, so the agent has context for
|
|
34
|
+
* the operator's next reply without any per-tool imperative. */
|
|
35
|
+
export declare function renderOnboardingBlock(step: number | null, resumePrompt?: string): RenderedOnboardingBlock | null;
|
|
33
36
|
//# sourceMappingURL=system-prompt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../src/system-prompt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../src/system-prompt.ts"],"names":[],"mappings":"AAmCA,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED;;;;;;;oCAOoC;AACpC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,eAAO,MAAM,wBAAwB,WAAa,CAAA;AAElD,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,WAAW,EACjB,UAAU,CAAC,EAAE,iBAAiB,GAC7B,MAAM,GAAG,IAAI,CAmBf;AAED,MAAM,WAAW,uBAAuB;IACtC,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAA;IACb;;kEAE8D;IAC9D,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;;iEAKiE;AACjE,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,YAAY,CAAC,EAAE,MAAM,GACpB,uBAAuB,GAAG,IAAI,CAShC"}
|
|
@@ -12,7 +12,18 @@
|
|
|
12
12
|
// caller supplies an `onboarding`
|
|
13
13
|
// payload AND the resolved step
|
|
14
14
|
// is anything other than 9
|
|
15
|
-
// (complete).
|
|
15
|
+
// (complete). State-only as of
|
|
16
|
+
// Task 066: the block carries
|
|
17
|
+
// currentStep / resumeStep
|
|
18
|
+
// attributes plus the script-
|
|
19
|
+
// resolved resume-prompt content
|
|
20
|
+
// quoted verbatim. No prose
|
|
21
|
+
// imperatives — the onboarding
|
|
22
|
+
// state machine is advanced by
|
|
23
|
+
// scripts/onboarding-advance.sh
|
|
24
|
+
// BEFORE the session is spawned,
|
|
25
|
+
// and the chat surface presents
|
|
26
|
+
// the script output verbatim.
|
|
16
27
|
//
|
|
17
28
|
// The block is the only doctrine surface that survives Claude Code SDK
|
|
18
29
|
// upgrades. Per Task 037, no skill carries a copy; one edit here changes the
|
|
@@ -38,7 +49,7 @@ export function composeAppendSystemPrompt(host, onboarding) {
|
|
|
38
49
|
'</attachment-ceiling>',
|
|
39
50
|
];
|
|
40
51
|
if (onboarding) {
|
|
41
|
-
const rendered = renderOnboardingBlock(onboarding.step);
|
|
52
|
+
const rendered = renderOnboardingBlock(onboarding.step, onboarding.resumePrompt);
|
|
42
53
|
if (rendered)
|
|
43
54
|
sections.push(rendered.block);
|
|
44
55
|
}
|
|
@@ -46,41 +57,53 @@ export function composeAppendSystemPrompt(host, onboarding) {
|
|
|
46
57
|
}
|
|
47
58
|
/** Render the onboarding-state section for a given step. Returns null when
|
|
48
59
|
* the agent should see no onboarding block (step === 9 = complete). The
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
|
|
60
|
+
* body is state-only per Task 066: currentStep + resumeStep attributes
|
|
61
|
+
* plus an optional `<resume-prompt-shown>` child carrying the verbatim
|
|
62
|
+
* output of the banner-click script run, so the agent has context for
|
|
63
|
+
* the operator's next reply without any per-tool imperative. */
|
|
64
|
+
export function renderOnboardingBlock(step, resumePrompt) {
|
|
53
65
|
if (step === 9)
|
|
54
66
|
return null;
|
|
55
67
|
if (step === null) {
|
|
56
|
-
return { block: renderUnreachableBlock(), label: 'graph-unreachable' };
|
|
68
|
+
return { block: renderUnreachableBlock(resumePrompt), label: 'graph-unreachable' };
|
|
57
69
|
}
|
|
58
70
|
if (step < 0) {
|
|
59
|
-
return { block: renderIncompleteBlock(-1), label: 'missing' };
|
|
71
|
+
return { block: renderIncompleteBlock(-1, resumePrompt), label: 'missing' };
|
|
60
72
|
}
|
|
61
|
-
return { block: renderIncompleteBlock(step), label: String(step) };
|
|
73
|
+
return { block: renderIncompleteBlock(step, resumePrompt), label: String(step) };
|
|
62
74
|
}
|
|
63
|
-
function renderIncompleteBlock(currentStep) {
|
|
75
|
+
function renderIncompleteBlock(currentStep, resumePrompt) {
|
|
64
76
|
const stepAttr = currentStep < 0 ? 'missing' : String(currentStep);
|
|
65
77
|
const resumeStep = currentStep < 0 ? 0 : currentStep + 1;
|
|
66
|
-
// Task
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
// Task 066 — state-only block. No prose imperatives, no named tools.
|
|
79
|
+
// The onboarding state machine is advanced by
|
|
80
|
+
// scripts/onboarding-advance.sh BEFORE the session is spawned; the
|
|
81
|
+
// chat surface presents that script's stdout verbatim. If the caller
|
|
82
|
+
// supplied `resumePrompt`, it is quoted here as `<resume-prompt-shown>`
|
|
83
|
+
// so the agent has the operator-visible context for the first reply
|
|
84
|
+
// without needing to derive it from the SKILL.md from scratch.
|
|
85
|
+
const lines = [`<onboarding-state currentStep="${stepAttr}" resumeStep="${resumeStep}">`];
|
|
86
|
+
if (resumePrompt && resumePrompt.trim()) {
|
|
87
|
+
lines.push('<resume-prompt-shown>');
|
|
88
|
+
lines.push(resumePrompt.trimEnd());
|
|
89
|
+
lines.push('</resume-prompt-shown>');
|
|
90
|
+
}
|
|
91
|
+
lines.push(`</onboarding-state>`);
|
|
92
|
+
return lines.join('\n');
|
|
78
93
|
}
|
|
79
|
-
function renderUnreachableBlock() {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
94
|
+
function renderUnreachableBlock(resumePrompt) {
|
|
95
|
+
// Task 066 — state-only, no imperatives. Agent reads
|
|
96
|
+
// `graphUnreachable="true"` plus the optional resume-prompt-shown
|
|
97
|
+
// content; how to relay the situation to the operator is the agent's
|
|
98
|
+
// judgement, anchored on the IDENTITY contract rather than a
|
|
99
|
+
// per-session directive.
|
|
100
|
+
const lines = [`<onboarding-state currentStep="unknown" graphUnreachable="true">`];
|
|
101
|
+
if (resumePrompt && resumePrompt.trim()) {
|
|
102
|
+
lines.push('<resume-prompt-shown>');
|
|
103
|
+
lines.push(resumePrompt.trimEnd());
|
|
104
|
+
lines.push('</resume-prompt-shown>');
|
|
105
|
+
}
|
|
106
|
+
lines.push(`</onboarding-state>`);
|
|
107
|
+
return lines.join('\n');
|
|
85
108
|
}
|
|
86
109
|
//# sourceMappingURL=system-prompt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../src/system-prompt.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,4EAA4E;AAC5E,EAAE;AACF,2EAA2E;AAC3E,oEAAoE;AACpE,mDAAmD;AACnD,6EAA6E;AAC7E,4EAA4E;AAC5E,4DAA4D;AAC5D,+CAA+C;AAC/C,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAC3E,sEAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../src/system-prompt.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,4EAA4E;AAC5E,EAAE;AACF,2EAA2E;AAC3E,oEAAoE;AACpE,mDAAmD;AACnD,6EAA6E;AAC7E,4EAA4E;AAC5E,4DAA4D;AAC5D,+CAA+C;AAC/C,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAC3E,sEAAsE;AACtE,0EAA0E;AAC1E,yEAAyE;AACzE,sEAAsE;AACtE,yEAAyE;AACzE,4EAA4E;AAC5E,uEAAuE;AACvE,0EAA0E;AAC1E,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E;AAC5E,2EAA2E;AAC3E,yEAAyE;AACzE,EAAE;AACF,uEAAuE;AACvE,6EAA6E;AAC7E,0DAA0D;AAC1D,EAAE;AACF,yEAAyE;AACzE,0EAA0E;AAC1E,qEAAqE;AAsBrE,MAAM,CAAC,MAAM,wBAAwB,GAAG,UAAU,CAAA,CAAC,mCAAmC;AAEtF,MAAM,UAAU,yBAAyB,CACvC,IAAiB,EACjB,UAA8B;IAE9B,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;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,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# onboarding-advance.sh — deterministic resume-prompt resolver. Task 066.
|
|
3
|
+
#
|
|
4
|
+
# Maps a current onboarding step (read from Neo4j by the route that invoked
|
|
5
|
+
# this script) to the operator-visible markdown prompt for the next
|
|
6
|
+
# incomplete step. Emits one stderr log line, writes the prompt to stdout,
|
|
7
|
+
# exits 0 on success.
|
|
8
|
+
#
|
|
9
|
+
# Contract:
|
|
10
|
+
# $1 accountId UUID, used in the stderr log line
|
|
11
|
+
# $2 currentStep integer (-1, 0..9), null sentinel, or 'null'
|
|
12
|
+
#
|
|
13
|
+
# Output:
|
|
14
|
+
# stdout: operator-visible markdown prompt (verbatim from prompts/step-N.md)
|
|
15
|
+
# stderr: single line "[onboarding-state] script-advance step=<N> sender=<id>"
|
|
16
|
+
# exit 0
|
|
17
|
+
#
|
|
18
|
+
# The route at platform/ui/server/routes/admin/claude-sessions.ts persists
|
|
19
|
+
# stdout as the first assistant-role message of the new session, then
|
|
20
|
+
# spawns the PTY without an initialMessage. The chat surface presents the
|
|
21
|
+
# script's output verbatim; the agent's first LLM turn fires only after the
|
|
22
|
+
# operator types their next reply, by which point onboarding context lives
|
|
23
|
+
# in the conversation history.
|
|
24
|
+
|
|
25
|
+
set -euo pipefail
|
|
26
|
+
|
|
27
|
+
ACCOUNT_ID="${1:?accountId required}"
|
|
28
|
+
CURRENT_STEP="${2:?currentStep required}"
|
|
29
|
+
|
|
30
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
31
|
+
PROMPT_DIR="$SCRIPT_DIR/onboarding-prompts"
|
|
32
|
+
|
|
33
|
+
case "$CURRENT_STEP" in
|
|
34
|
+
null|unreachable)
|
|
35
|
+
RESUME="unreachable"
|
|
36
|
+
;;
|
|
37
|
+
-1)
|
|
38
|
+
RESUME="0"
|
|
39
|
+
;;
|
|
40
|
+
9)
|
|
41
|
+
RESUME="complete"
|
|
42
|
+
;;
|
|
43
|
+
0|1|2|3|4|5|6|7|8)
|
|
44
|
+
RESUME="$((CURRENT_STEP + 1))"
|
|
45
|
+
;;
|
|
46
|
+
*)
|
|
47
|
+
printf '[onboarding-state] script-advance step=invalid sender=%s\n' "$ACCOUNT_ID" >&2
|
|
48
|
+
echo "Onboarding step value is not in the expected range. Tell the operator the state is corrupt and stop." >&2
|
|
49
|
+
exit 64
|
|
50
|
+
;;
|
|
51
|
+
esac
|
|
52
|
+
|
|
53
|
+
PROMPT_FILE="$PROMPT_DIR/step-$RESUME.md"
|
|
54
|
+
if [ ! -f "$PROMPT_FILE" ]; then
|
|
55
|
+
printf '[onboarding-state] script-advance step=missing-template sender=%s\n' "$ACCOUNT_ID" >&2
|
|
56
|
+
echo "Resume-prompt template missing for step $RESUME." >&2
|
|
57
|
+
exit 65
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
cat "$PROMPT_FILE"
|
|
61
|
+
printf '[onboarding-state] script-advance step=%s sender=%s\n' "$RESUME" "$ACCOUNT_ID" >&2
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Onboarding is at step 0 — we have not started yet.
|
|
2
|
+
|
|
3
|
+
The first step is plugin selection. The other steps cover WiFi, output style, thinking view, timezone, admin personality, optional Cloudflare remote access, optional public-agent API key, and persona / business profile.
|
|
4
|
+
|
|
5
|
+
Reply `start` to begin, or ask any question about what onboarding will cover.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Resuming onboarding at step 1 — plugin selection.
|
|
2
|
+
|
|
3
|
+
Reply `list` to see the plugins available on this brand, grouped by category, with their descriptions and which are locked, recommended, or optional. Reply with the plugin names you want to enable (or `skip` to enable none) once the list is in view.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Resuming onboarding at step 2 — WiFi setup.
|
|
2
|
+
|
|
3
|
+
Reply `check wifi` to see whether this device has WiFi hardware and whether it is already connected. If it is, you can keep the current network or switch. If it is not connected, you can scan visible networks and connect, or skip and stay on ethernet.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Resuming onboarding at step 3 — output style.
|
|
2
|
+
|
|
3
|
+
Two choices:
|
|
4
|
+
|
|
5
|
+
1. `default` — efficient and task-oriented; concise responses without extra explanation.
|
|
6
|
+
2. `explanatory` — adds educational insights between steps; useful when you want to understand what the agent is doing.
|
|
7
|
+
|
|
8
|
+
Reply with the number or the value.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Resuming onboarding at step 4 — thinking view.
|
|
2
|
+
|
|
3
|
+
Three choices:
|
|
4
|
+
|
|
5
|
+
1. `default` — thinking visible: reasoning expanded, tool details collapsed.
|
|
6
|
+
2. `expanded` — everything visible: all reasoning and tool details expanded.
|
|
7
|
+
3. `collapsed` — responses only: all reasoning and tool details collapsed.
|
|
8
|
+
|
|
9
|
+
Reply with the number or the value.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Resuming onboarding at step 6 — admin agent personality.
|
|
2
|
+
|
|
3
|
+
This step writes the agent's tone, working style, and language preferences to `agents/admin/SOUL.md`. Business identity (services, FAQs, addresses) belongs in step 9 — keep this step to personality.
|
|
4
|
+
|
|
5
|
+
Reply with how you want the agent to sound (formal, casual, warm, blunt) and how you want it to collaborate (proactive vs. wait-for-instruction, terse vs. explanatory). The agent will compose a draft, show it to you, and only save once you approve.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Resuming onboarding at step 7 — Cloudflare remote access.
|
|
2
|
+
|
|
3
|
+
This step connects the platform to a custom domain so you and your customers can reach it from anywhere. Without it, the platform stays local-network-only — WhatsApp, Telegram, and email still work without a tunnel.
|
|
4
|
+
|
|
5
|
+
Reply `yes` to set it up now (you will need a Cloudflare account and a domain), or `skip` to leave remote access for later.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Resuming onboarding at step 8 — Anthropic API key.
|
|
2
|
+
|
|
3
|
+
The public-facing agent uses the Anthropic API directly, so visitors can chat with the business through the public hostname. Without a key, visitors cannot chat. This step is optional.
|
|
4
|
+
|
|
5
|
+
Reply `yes` to set it up now, or `skip` to leave it for later. If you set it up, you will sign in to the Anthropic Console in a browser; the agent does not handle credentials.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Resuming onboarding at step 9 — operator persona and profile bootstrap.
|
|
2
|
+
|
|
3
|
+
Two persona modes:
|
|
4
|
+
|
|
5
|
+
1. `personal` — just for me. I am not setting this up for a business; the platform is my personal operations agent.
|
|
6
|
+
2. `business-owner` — for my business. I am the owner / operator and the platform is the operations agent for my company.
|
|
7
|
+
|
|
8
|
+
Reply with the number, the value, or the label.
|
|
@@ -53,4 +53,4 @@ When you need to clarify intent before acting, follow two rules.
|
|
|
53
53
|
|
|
54
54
|
Run `skill-load skillName=plainly` on the first text-producing turn of every session. Apply the AI-tells strip and the recursive plain-English rule to every reply you return to the visitor before emitting it — this is a prime-directive prerogative that overrides every other formatting preference. Customers are the highest-stakes audience this platform serves; plain English is not a polish step, it is the contract.
|
|
55
55
|
|
|
56
|
-
The skill applies to prose returned to the visitor
|
|
56
|
+
The skill applies to every prose payload returned to the visitor. It does NOT apply to structured tool arguments (IDs, option values, schema field names) — those are agent-to-machine payloads.
|
|
@@ -3,7 +3,7 @@ name: content-producer
|
|
|
3
3
|
description: "Visual production and static-site hosting. Reads from the populated graph to produce visual artifacts (image generation, PDF rendering, component delivery) and hosts already-prepared static sites by extracting attached archives via unzip-attachment then placing the tree under <accountDir>/sites/<slug>/ via publish-site. Delegate for: generating images, saving rendered pages as PDF, or any 'host this website' / 'publish this site' / 'put this online' intent carrying an HTML+assets archive. Not document ingestion: graph ingestion of any kind routes to specialists:database-operator. Static-site zips are extracted to disk for publication, never written to the graph."
|
|
4
4
|
summary: "Produces visual output from your graph: generates images, renders pages to PDF, and hosts static websites you upload as a zip."
|
|
5
5
|
model: claude-sonnet-4-6
|
|
6
|
-
tools: Bash, mcp__memory__memory-search, mcp__replicate__image-generate, mcp__plugin_playwright_playwright__browser_navigate, mcp__plugin_playwright_playwright__browser_snapshot, mcp__plugin_playwright_playwright__browser_take_screenshot, mcp__plugin_playwright_playwright__browser_pdf_save,
|
|
6
|
+
tools: Bash, mcp__memory__memory-search, mcp__replicate__image-generate, mcp__plugin_playwright_playwright__browser_navigate, mcp__plugin_playwright_playwright__browser_snapshot, mcp__plugin_playwright_playwright__browser_take_screenshot, mcp__plugin_playwright_playwright__browser_pdf_save, mcp__admin__file-attach, mcp__admin__plugin-read, mcp__admin__public-hostname
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# Content Producer
|
|
@@ -28,7 +28,7 @@ Three models via `image-generate`. Pick by output need: `recraft-v4` for design-
|
|
|
28
28
|
|
|
29
29
|
## PDF output
|
|
30
30
|
|
|
31
|
-
Generate the HTML,
|
|
31
|
+
Generate the HTML, navigate the Playwright browser to it, and capture with `browser_pdf_save`. For A4 print, load `skill-load skillName=a4-print-documents`: the skill carries the print-CSS constraints (page margins, glassmorphism fallback, page-break rules, dark-background colour-adjust). Do not paraphrase those rules; load and follow.
|
|
32
32
|
|
|
33
33
|
`file://` URLs are rewritten transparently by the `playwright-file-guard` PreToolUse hook. Pass them directly to `browser_navigate`.
|
|
34
34
|
|
|
@@ -40,7 +40,7 @@ Confirm the slug with the operator before publishing. The slug is one or more `/
|
|
|
40
40
|
|
|
41
41
|
## File delivery
|
|
42
42
|
|
|
43
|
-
Use `file-attach` to make generated files downloadable
|
|
43
|
+
Use `file-attach` to make generated files downloadable. The tool returns the operator-visible metadata (filename, size, attachment URL); quote that metadata back in plain chat so the operator can see the download.
|
|
44
44
|
|
|
45
45
|
## Optional capabilities
|
|
46
46
|
|