@gajae-code/coding-agent 0.6.4 → 0.7.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.
- package/CHANGELOG.md +51 -0
- package/dist/types/async/job-manager.d.ts +3 -1
- package/dist/types/cli/daemon-cli.d.ts +25 -0
- package/dist/types/cli/migrate-cli.d.ts +20 -0
- package/dist/types/cli/notify-cli.d.ts +23 -0
- package/dist/types/cli/setup-cli.d.ts +20 -1
- package/dist/types/commands/daemon.d.ts +41 -0
- package/dist/types/commands/migrate.d.ts +33 -0
- package/dist/types/commands/notify.d.ts +41 -0
- package/dist/types/config/keybindings.d.ts +4 -0
- package/dist/types/config/model-profile-activation.d.ts +12 -0
- package/dist/types/config/model-profiles.d.ts +2 -1
- package/dist/types/config/model-registry.d.ts +3 -3
- package/dist/types/config/models-config-schema.d.ts +5 -0
- package/dist/types/config/settings-schema.d.ts +38 -0
- package/dist/types/coordinator/contract.d.ts +1 -1
- package/dist/types/daemon/builtin.d.ts +20 -0
- package/dist/types/daemon/control-types.d.ts +57 -0
- package/dist/types/daemon/runtime.d.ts +25 -0
- package/dist/types/extensibility/extensions/types.d.ts +8 -0
- package/dist/types/gjc-runtime/deep-interview-recorder.d.ts +2 -0
- package/dist/types/gjc-runtime/deep-interview-runtime.d.ts +2 -2
- package/dist/types/gjc-runtime/goal-mode-request.d.ts +1 -1
- package/dist/types/gjc-runtime/session-layout.d.ts +59 -0
- package/dist/types/gjc-runtime/session-resolution.d.ts +47 -0
- package/dist/types/gjc-runtime/state-graph.d.ts +1 -1
- package/dist/types/gjc-runtime/state-runtime.d.ts +5 -4
- package/dist/types/gjc-runtime/state-schema.d.ts +2 -0
- package/dist/types/gjc-runtime/state-writer.d.ts +38 -7
- package/dist/types/gjc-runtime/ultragoal-guard.d.ts +15 -0
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +21 -4
- package/dist/types/gjc-runtime/workflow-command-ref.d.ts +1 -1
- package/dist/types/gjc-runtime/workflow-manifest.d.ts +1 -1
- package/dist/types/harness-control-plane/storage.d.ts +2 -1
- package/dist/types/hooks/skill-state.d.ts +12 -4
- package/dist/types/migrate/action-planner.d.ts +11 -0
- package/dist/types/migrate/adapters/claude-code.d.ts +2 -0
- package/dist/types/migrate/adapters/codex.d.ts +5 -0
- package/dist/types/migrate/adapters/index.d.ts +45 -0
- package/dist/types/migrate/adapters/opencode.d.ts +2 -0
- package/dist/types/migrate/executor.d.ts +2 -0
- package/dist/types/migrate/mcp-mapper.d.ts +20 -0
- package/dist/types/migrate/report.d.ts +18 -0
- package/dist/types/migrate/skill-normalizer.d.ts +27 -0
- package/dist/types/migrate/types.d.ts +126 -0
- package/dist/types/modes/components/custom-editor.d.ts +1 -1
- package/dist/types/modes/components/oauth-selector.d.ts +2 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +2 -2
- package/dist/types/modes/interactive-mode.d.ts +1 -1
- package/dist/types/modes/shared/agent-wire/unattended-audit.d.ts +1 -1
- package/dist/types/modes/shared/agent-wire/unattended-session.d.ts +10 -0
- package/dist/types/modes/types.d.ts +7 -1
- package/dist/types/notifications/config-commands.d.ts +26 -0
- package/dist/types/notifications/config.d.ts +61 -0
- package/dist/types/notifications/helpers.d.ts +55 -0
- package/dist/types/notifications/html-format.d.ts +62 -0
- package/dist/types/notifications/index.d.ts +28 -0
- package/dist/types/notifications/rate-limit-pool.d.ts +93 -0
- package/dist/types/notifications/telegram-cli.d.ts +19 -0
- package/dist/types/notifications/telegram-daemon-cli.d.ts +11 -0
- package/dist/types/notifications/telegram-daemon-control.d.ts +56 -0
- package/dist/types/notifications/telegram-daemon.d.ts +276 -0
- package/dist/types/notifications/telegram-reference.d.ts +111 -0
- package/dist/types/notifications/threaded-inbound.d.ts +58 -0
- package/dist/types/notifications/threaded-render.d.ts +66 -0
- package/dist/types/notifications/topic-registry.d.ts +67 -0
- package/dist/types/research-plan/index.d.ts +1 -0
- package/dist/types/research-plan/ledger.d.ts +33 -0
- package/dist/types/rlm/artifacts.d.ts +1 -1
- package/dist/types/rlm/index.d.ts +12 -0
- package/dist/types/runtime-mcp/config-writer.d.ts +26 -0
- package/dist/types/session/agent-session.d.ts +39 -2
- package/dist/types/session/auth-storage.d.ts +1 -1
- package/dist/types/setup/credential-auto-import.d.ts +63 -0
- package/dist/types/setup/credential-import.d.ts +3 -0
- package/dist/types/setup/host-plugin-setup.d.ts +39 -0
- package/dist/types/skill-state/active-state.d.ts +6 -11
- package/dist/types/skill-state/canonical-skills.d.ts +3 -0
- package/dist/types/skill-state/workflow-hud.d.ts +2 -0
- package/dist/types/task/spawn-gate.d.ts +1 -10
- package/dist/types/tools/ask-answer-registry.d.ts +13 -0
- package/dist/types/tools/index.d.ts +18 -0
- package/dist/types/tools/subagent.d.ts +3 -0
- package/package.json +7 -7
- package/scripts/build-binary.ts +3 -0
- package/src/async/job-manager.ts +5 -1
- package/src/cli/daemon-cli.ts +122 -0
- package/src/cli/migrate-cli.ts +106 -0
- package/src/cli/notify-cli.ts +274 -0
- package/src/cli/setup-cli.ts +173 -84
- package/src/cli.ts +3 -0
- package/src/commands/daemon.ts +47 -0
- package/src/commands/deep-interview.ts +2 -2
- package/src/commands/migrate.ts +46 -0
- package/src/commands/notify.ts +61 -0
- package/src/commands/setup.ts +11 -1
- package/src/commands/state.ts +2 -1
- package/src/commands/team.ts +7 -3
- package/src/config/model-profile-activation.ts +74 -5
- package/src/config/model-profiles.ts +7 -4
- package/src/config/model-registry.ts +6 -3
- package/src/config/models-config-schema.ts +1 -1
- package/src/config/settings-schema.ts +29 -0
- package/src/coordinator/contract.ts +3 -0
- package/src/coordinator-mcp/policy.ts +10 -2
- package/src/coordinator-mcp/server.ts +270 -1
- package/src/daemon/builtin.ts +46 -0
- package/src/daemon/control-types.ts +65 -0
- package/src/daemon/runtime.ts +51 -0
- package/src/defaults/gjc/extensions/grok-cli-vendor/biome.json +0 -1
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +28 -24
- package/src/defaults/gjc/skills/ralplan/SKILL.md +8 -4
- package/src/defaults/gjc/skills/team/SKILL.md +51 -47
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +33 -13
- package/src/extensibility/custom-commands/loader.ts +0 -7
- package/src/extensibility/extensions/runner.ts +4 -0
- package/src/extensibility/extensions/types.ts +8 -0
- package/src/extensibility/gjc-plugins/injection.ts +23 -4
- package/src/extensibility/gjc-plugins/state.ts +16 -1
- package/src/gjc-runtime/deep-interview-recorder.ts +51 -18
- package/src/gjc-runtime/deep-interview-runtime.ts +49 -23
- package/src/gjc-runtime/goal-mode-request.ts +26 -11
- package/src/gjc-runtime/launch-tmux.ts +6 -1
- package/src/gjc-runtime/ralplan-runtime.ts +79 -50
- package/src/gjc-runtime/session-layout.ts +180 -0
- package/src/gjc-runtime/session-resolution.ts +217 -0
- package/src/gjc-runtime/state-graph.ts +1 -2
- package/src/gjc-runtime/state-migrations.ts +1 -0
- package/src/gjc-runtime/state-runtime.ts +247 -124
- package/src/gjc-runtime/state-schema.ts +2 -0
- package/src/gjc-runtime/state-writer.ts +289 -41
- package/src/gjc-runtime/team-runtime.ts +43 -19
- package/src/gjc-runtime/tmux-sessions.ts +7 -1
- package/src/gjc-runtime/ultragoal-guard.ts +102 -4
- package/src/gjc-runtime/ultragoal-runtime.ts +226 -60
- package/src/gjc-runtime/workflow-command-ref.ts +1 -2
- package/src/gjc-runtime/workflow-manifest.generated.json +27 -2
- package/src/gjc-runtime/workflow-manifest.ts +12 -3
- package/src/goals/tools/goal-tool.ts +11 -2
- package/src/harness-control-plane/storage.ts +14 -4
- package/src/hooks/native-skill-hook.ts +38 -12
- package/src/hooks/skill-state.ts +178 -83
- package/src/internal-urls/docs-index.generated.ts +9 -6
- package/src/main.ts +30 -0
- package/src/migrate/action-planner.ts +318 -0
- package/src/migrate/adapters/claude-code.ts +39 -0
- package/src/migrate/adapters/codex.ts +70 -0
- package/src/migrate/adapters/index.ts +277 -0
- package/src/migrate/adapters/opencode.ts +52 -0
- package/src/migrate/executor.ts +81 -0
- package/src/migrate/mcp-mapper.ts +152 -0
- package/src/migrate/report.ts +104 -0
- package/src/migrate/skill-normalizer.ts +80 -0
- package/src/migrate/types.ts +163 -0
- package/src/modes/acp/acp-event-mapper.ts +1 -0
- package/src/modes/bridge/bridge-mode.ts +2 -2
- package/src/modes/components/custom-editor.ts +30 -20
- package/src/modes/components/hook-editor.ts +7 -2
- package/src/modes/components/oauth-selector.ts +19 -0
- package/src/modes/controllers/event-controller.ts +20 -0
- package/src/modes/controllers/selector-controller.ts +80 -17
- package/src/modes/interactive-mode.ts +6 -2
- package/src/modes/rpc/rpc-mode.ts +2 -2
- package/src/modes/runtime-init.ts +1 -0
- package/src/modes/shared/agent-wire/event-contract.ts +1 -0
- package/src/modes/shared/agent-wire/event-envelope.ts +1 -0
- package/src/modes/shared/agent-wire/event-observation.ts +16 -0
- package/src/modes/shared/agent-wire/unattended-audit.ts +3 -2
- package/src/modes/shared/agent-wire/unattended-session.ts +22 -0
- package/src/modes/types.ts +7 -1
- package/src/modes/utils/ui-helpers.ts +23 -0
- package/src/notifications/config-commands.ts +50 -0
- package/src/notifications/config.ts +107 -0
- package/src/notifications/helpers.ts +135 -0
- package/src/notifications/html-format.ts +389 -0
- package/src/notifications/index.ts +663 -0
- package/src/notifications/rate-limit-pool.ts +179 -0
- package/src/notifications/telegram-cli.ts +194 -0
- package/src/notifications/telegram-daemon-cli.ts +74 -0
- package/src/notifications/telegram-daemon-control.ts +370 -0
- package/src/notifications/telegram-daemon.ts +1370 -0
- package/src/notifications/telegram-reference.ts +335 -0
- package/src/notifications/threaded-inbound.ts +80 -0
- package/src/notifications/threaded-render.ts +155 -0
- package/src/notifications/topic-registry.ts +133 -0
- package/src/prompts/agents/init.md +1 -1
- package/src/prompts/system/plan-mode-active.md +1 -1
- package/src/prompts/tools/ast-grep.md +1 -1
- package/src/prompts/tools/search.md +1 -1
- package/src/prompts/tools/task.md +1 -2
- package/src/research-plan/index.ts +1 -0
- package/src/research-plan/ledger.ts +177 -0
- package/src/rlm/artifacts.ts +12 -3
- package/src/rlm/index.ts +26 -0
- package/src/runtime-mcp/config-writer.ts +46 -0
- package/src/sdk.ts +16 -0
- package/src/session/agent-session.ts +128 -24
- package/src/session/auth-storage.ts +3 -0
- package/src/session/session-dump-format.ts +43 -2
- package/src/session/session-manager.ts +39 -5
- package/src/setup/credential-auto-import.ts +258 -0
- package/src/setup/credential-import.ts +17 -0
- package/src/setup/hermes/templates/operator-instructions.v1.md +10 -0
- package/src/setup/hermes-setup.ts +1 -1
- package/src/setup/host-plugin-setup.ts +142 -0
- package/src/skill-state/active-state.ts +72 -108
- package/src/skill-state/canonical-skills.ts +4 -0
- package/src/skill-state/deep-interview-mutation-guard.ts +28 -109
- package/src/skill-state/workflow-hud.ts +4 -2
- package/src/skill-state/workflow-state-contract.ts +3 -3
- package/src/slash-commands/builtin-registry.ts +4 -1
- package/src/task/agents.ts +1 -22
- package/src/task/executor.ts +5 -1
- package/src/task/index.ts +1 -41
- package/src/task/spawn-gate.ts +1 -38
- package/src/task/types.ts +1 -1
- package/src/tools/ask-answer-registry.ts +25 -0
- package/src/tools/ask.ts +108 -16
- package/src/tools/computer.ts +58 -4
- package/src/tools/image-gen.ts +5 -8
- package/src/tools/index.ts +19 -0
- package/src/tools/inspect-image.ts +16 -11
- package/src/tools/subagent-render.ts +7 -0
- package/src/tools/subagent.ts +38 -7
- package/dist/types/extensibility/custom-commands/bundled/review/index.d.ts +0 -10
- package/src/extensibility/custom-commands/bundled/review/index.ts +0 -456
- package/src/prompts/agents/explore.md +0 -58
- package/src/prompts/agents/plan.md +0 -49
- package/src/prompts/agents/reviewer.md +0 -141
- package/src/prompts/agents/task.md +0 -16
- package/src/prompts/review-request.md +0 -70
|
@@ -13,12 +13,12 @@ export interface DeepInterviewCommandResult {
|
|
|
13
13
|
stdout?: string;
|
|
14
14
|
stderr?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare function deepInterviewStatePath(cwd: string, sessionId
|
|
16
|
+
export declare function deepInterviewStatePath(cwd: string, sessionId?: string): string;
|
|
17
17
|
export interface ResolvedDeepInterviewSpecWriteArgs {
|
|
18
18
|
stage: "final";
|
|
19
19
|
slug: string;
|
|
20
20
|
spec: string;
|
|
21
|
-
sessionId
|
|
21
|
+
sessionId: string;
|
|
22
22
|
json: boolean;
|
|
23
23
|
deliberate: boolean;
|
|
24
24
|
handoff?: "ralplan";
|
|
@@ -30,7 +30,7 @@ export type CurrentSessionGoalModeWriteResult = {
|
|
|
30
30
|
sessionFile: string;
|
|
31
31
|
};
|
|
32
32
|
export declare function isUltragoalCreateGoalsInvocation(args: readonly string[]): boolean;
|
|
33
|
-
export declare function readUltragoalGjcObjective(cwd: string): Promise<{
|
|
33
|
+
export declare function readUltragoalGjcObjective(cwd: string, sessionId?: string | null): Promise<{
|
|
34
34
|
objective: string;
|
|
35
35
|
goalsPath: string;
|
|
36
36
|
}>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export declare const GJC_DIR = ".gjc";
|
|
2
|
+
export declare const GJC_SESSION_PREFIX = "_session-";
|
|
3
|
+
export declare const GJC_SESSION_ACTIVITY_FILE = ".session-activity.json";
|
|
4
|
+
/** Source that produced a resolved GJC session id, for audit/diagnostics. */
|
|
5
|
+
export type GjcSessionSource = "flag" | "payload" | "env" | "latest";
|
|
6
|
+
export interface GjcSessionContext {
|
|
7
|
+
gjcSessionId: string;
|
|
8
|
+
sessionRoot: string;
|
|
9
|
+
source: GjcSessionSource;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Encode a session id into a single safe path segment. Matches the historical
|
|
13
|
+
* encoding used across the runtimes so ids round-trip identically:
|
|
14
|
+
* `encodeURIComponent` plus dot-escaping (dots are legal in filenames but we
|
|
15
|
+
* avoid `.`/`..` traversal ambiguity).
|
|
16
|
+
*/
|
|
17
|
+
export declare function encodeSessionSegment(value: string): string;
|
|
18
|
+
/** Inverse of {@link encodeSessionSegment}. */
|
|
19
|
+
export declare function decodeSessionSegment(segment: string): string;
|
|
20
|
+
/** Throw when a session id is missing or blank; never let blank suppress callers. */
|
|
21
|
+
export declare function assertNonEmptyGjcSessionId(value: string | undefined, source: string): asserts value is string;
|
|
22
|
+
/**
|
|
23
|
+
* Assert a value is safe to use as a single path segment: non-blank and free of
|
|
24
|
+
* path separators or `.`/`..` traversal. Use for already-safe identifiers
|
|
25
|
+
* (skill modes, slugs) where we want identical filenames but fail closed on
|
|
26
|
+
* traversal rather than silently normalizing out of the intended directory.
|
|
27
|
+
*/
|
|
28
|
+
export declare function assertSafePathComponent(value: string, label: string): void;
|
|
29
|
+
/** The shared `.gjc/` root (holds shared config; never session-scoped). */
|
|
30
|
+
export declare function gjcRoot(cwd: string): string;
|
|
31
|
+
/** The per-session root directory: `<cwd>/.gjc/_session-{encodedId}`. */
|
|
32
|
+
export declare function sessionRoot(cwd: string, gjcSessionId: string): string;
|
|
33
|
+
/** Directory name (no path) for a session id, e.g. `_session-abc`. */
|
|
34
|
+
export declare function sessionDirName(gjcSessionId: string): string;
|
|
35
|
+
/** Return the decoded session id for a `_session-*` directory name, else undefined. */
|
|
36
|
+
export declare function sessionIdFromDirName(name: string): string | undefined;
|
|
37
|
+
/** Authoritative per-session activity marker path. */
|
|
38
|
+
export declare function sessionActivityPath(cwd: string, gjcSessionId: string): string;
|
|
39
|
+
export declare function sessionStateDir(cwd: string, gjcSessionId: string): string;
|
|
40
|
+
export declare function sessionSpecsDir(cwd: string, gjcSessionId: string): string;
|
|
41
|
+
export declare function sessionPlansDir(cwd: string, gjcSessionId: string): string;
|
|
42
|
+
export declare function sessionUltragoalDir(cwd: string, gjcSessionId: string): string;
|
|
43
|
+
export declare function sessionAuditDir(cwd: string, gjcSessionId: string): string;
|
|
44
|
+
export declare function sessionReportsDir(cwd: string, gjcSessionId: string): string;
|
|
45
|
+
export declare function sessionLogsDir(cwd: string, gjcSessionId: string): string;
|
|
46
|
+
export declare function sessionRuntimeDir(cwd: string, gjcSessionId: string): string;
|
|
47
|
+
export declare function sessionRlmDir(cwd: string, gjcSessionId: string): string;
|
|
48
|
+
export declare function activeStateDir(cwd: string, gjcSessionId: string): string;
|
|
49
|
+
export declare function activeSnapshotPath(cwd: string, gjcSessionId: string): string;
|
|
50
|
+
export declare function activeEntryPath(cwd: string, gjcSessionId: string, skill: string): string;
|
|
51
|
+
export declare function modeStatePath(cwd: string, gjcSessionId: string, mode: string): string;
|
|
52
|
+
export declare function auditPath(cwd: string, gjcSessionId: string): string;
|
|
53
|
+
export declare function transactionJournalPath(cwd: string, gjcSessionId: string, mutationId: string): string;
|
|
54
|
+
export declare function teamStateRoot(cwd: string, gjcSessionId: string): string;
|
|
55
|
+
export declare function workflowGatePath(cwd: string, gjcSessionId: string, gateId: string): string;
|
|
56
|
+
export declare function harnessStateRoot(cwd: string, gjcSessionId: string): string;
|
|
57
|
+
export declare function coordinatorMcpStateRoot(cwd: string, gjcSessionId: string): string;
|
|
58
|
+
export declare function tmuxRuntimeSessionPath(cwd: string, gjcSessionId: string, slug: string): string;
|
|
59
|
+
export declare function rlmArtifactRoot(cwd: string, gjcSessionId: string, rlmSessionId: string): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type GjcSessionContext, type GjcSessionSource } from "./session-layout";
|
|
2
|
+
/** Window within which two activity timestamps are treated as an ambiguous tie. */
|
|
3
|
+
export declare const LATEST_SESSION_TIE_WINDOW_MS = 1000;
|
|
4
|
+
export interface SessionIdSources {
|
|
5
|
+
/** Raw `--session-id` value: `undefined` = flag absent; `""` = present-but-blank (invalid). */
|
|
6
|
+
flagValue?: string | undefined;
|
|
7
|
+
payloadSessionId?: unknown;
|
|
8
|
+
envSessionId?: string | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare class SessionResolutionError extends Error {
|
|
11
|
+
readonly code: "blank_flag" | "no_session" | "ambiguous" | "missing_for_write";
|
|
12
|
+
constructor(message: string, code: "blank_flag" | "no_session" | "ambiguous" | "missing_for_write");
|
|
13
|
+
}
|
|
14
|
+
interface ResolvedFromSources {
|
|
15
|
+
gjcSessionId: string;
|
|
16
|
+
source: GjcSessionSource;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolve a session id from explicit sources only (flag -> payload -> env).
|
|
20
|
+
* Returns `undefined` when none is present. A blank explicit flag throws.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveSessionIdFromSources(sources: SessionIdSources): ResolvedFromSources | undefined;
|
|
23
|
+
/** Resolve session context for a WRITE command. Errors when no explicit id is present. */
|
|
24
|
+
export declare function resolveGjcSessionForWrite(cwd: string, sources: SessionIdSources): GjcSessionContext;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve session context for a READ/STATUS/CLEAR command. Falls back to the
|
|
27
|
+
* latest active session by activity marker when no explicit id is present.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveGjcSessionForRead(cwd: string, sources: SessionIdSources): Promise<GjcSessionContext>;
|
|
30
|
+
/**
|
|
31
|
+
* Scan `.gjc/_session-*` directories and select the most-recently-active one by
|
|
32
|
+
* its activity marker. Never uses raw directory mtime. Throws on zero candidates
|
|
33
|
+
* or an ambiguous tie.
|
|
34
|
+
*/
|
|
35
|
+
export declare function detectLatestSession(cwd: string): Promise<GjcSessionContext>;
|
|
36
|
+
export interface ActivityMarkerInfo {
|
|
37
|
+
writer: string;
|
|
38
|
+
/** Relative generated path that was just written, for diagnostics. */
|
|
39
|
+
path?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Best-effort write of the per-session activity marker. State-command callers
|
|
43
|
+
* MUST treat a thrown error as a command failure (auto-detect depends on it);
|
|
44
|
+
* non-critical writers may swallow it.
|
|
45
|
+
*/
|
|
46
|
+
export declare function writeSessionActivityMarker(cwd: string, gjcSessionId: string, info: ActivityMarkerInfo): Promise<void>;
|
|
47
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CanonicalGjcWorkflowSkill } from "../skill-state/canonical-skills";
|
|
2
2
|
export type StateGraphSkill = CanonicalGjcWorkflowSkill | "all";
|
|
3
3
|
export type StateGraphFormat = "ascii" | "mermaid" | "dot";
|
|
4
4
|
export declare function renderStateGraph(skill: StateGraphSkill, format?: string): string;
|
|
@@ -2,9 +2,9 @@ import { type CanonicalGjcWorkflowSkill } from "../skill-state/active-state";
|
|
|
2
2
|
/**
|
|
3
3
|
* Native implementation of the `gjc state read|write|clear` command surface.
|
|
4
4
|
*
|
|
5
|
-
* Simple file-receipt operations against
|
|
6
|
-
* `.gjc/
|
|
7
|
-
*
|
|
5
|
+
* Simple file-receipt operations against session-scoped state under
|
|
6
|
+
* `.gjc/_session-{id}/state/`. This is the sanctioned CLI mediator for
|
|
7
|
+
* mutation-guarded GJC state — agents call it instead of editing those files directly.
|
|
8
8
|
*/
|
|
9
9
|
export interface StateCommandResult {
|
|
10
10
|
status: number;
|
|
@@ -24,12 +24,13 @@ export interface StateCommandResult {
|
|
|
24
24
|
export declare function reconcileWorkflowSkillState(options: {
|
|
25
25
|
cwd: string;
|
|
26
26
|
mode: CanonicalGjcWorkflowSkill;
|
|
27
|
-
sessionId
|
|
27
|
+
sessionId?: string;
|
|
28
28
|
threadId?: string;
|
|
29
29
|
turnId?: string;
|
|
30
30
|
active: boolean;
|
|
31
31
|
phase: string;
|
|
32
32
|
payload: Record<string, unknown>;
|
|
33
|
+
sourceRevision?: number;
|
|
33
34
|
}): Promise<{
|
|
34
35
|
stateFile: string;
|
|
35
36
|
}>;
|
|
@@ -84,6 +84,7 @@ export declare const WorkflowStateEnvelopeSchema: z.ZodObject<{
|
|
|
84
84
|
computed_at: z.ZodString;
|
|
85
85
|
}, z.core.$loose>>;
|
|
86
86
|
}, z.core.$loose>>;
|
|
87
|
+
state_revision: z.ZodOptional<z.ZodNumber>;
|
|
87
88
|
}, z.core.$loose>;
|
|
88
89
|
/**
|
|
89
90
|
* Strict receipt required on WRITE (post checksum-stamping). Anchored to the
|
|
@@ -164,6 +165,7 @@ export declare const RequiredOnWriteEnvelopeSchema: z.ZodObject<{
|
|
|
164
165
|
computed_at: z.ZodString;
|
|
165
166
|
}, z.core.$loose>;
|
|
166
167
|
}, z.core.$loose>;
|
|
168
|
+
state_revision: z.ZodOptional<z.ZodNumber>;
|
|
167
169
|
}, z.core.$loose>;
|
|
168
170
|
/** Per-skill mode state consumed by hooks / the mutation guard. */
|
|
169
171
|
export declare const ModeStateSchema: z.ZodObject<{
|
|
@@ -11,7 +11,7 @@ import { type AuditEntry, type CanonicalGjcWorkflowSkill, type WorkflowStateMuta
|
|
|
11
11
|
* supplied mutation context. No lockfiles are used; isolation is by atomic rename,
|
|
12
12
|
* append, O_EXCL creates, conditional deletes, per-entry active-state files,
|
|
13
13
|
* and derived active-state snapshots.
|
|
14
|
-
* Transaction journals are per mutation id under
|
|
14
|
+
* Transaction journals are per mutation id under the session state transactions directory;
|
|
15
15
|
* they are recovery evidence only, never global locks or waiters, so stale
|
|
16
16
|
* journals do not block unrelated state reads or writes.
|
|
17
17
|
*/
|
|
@@ -24,9 +24,14 @@ export interface StateWriterReceiptContext {
|
|
|
24
24
|
sessionId?: string;
|
|
25
25
|
mutationId?: string;
|
|
26
26
|
nowIso?: string;
|
|
27
|
+
verb?: string;
|
|
28
|
+
fromPhase?: string;
|
|
29
|
+
toPhase?: string;
|
|
30
|
+
forced?: boolean;
|
|
27
31
|
}
|
|
28
32
|
export interface StateWriterAuditContext {
|
|
29
33
|
cwd?: string;
|
|
34
|
+
sessionId?: string;
|
|
30
35
|
category: WriterCategory;
|
|
31
36
|
verb: string;
|
|
32
37
|
owner: WorkflowStateMutationOwner;
|
|
@@ -52,10 +57,27 @@ export interface WorkflowTransactionJournal {
|
|
|
52
57
|
paths: string[];
|
|
53
58
|
steps: string[];
|
|
54
59
|
}
|
|
60
|
+
export type StateWritePolicy = "source" | "cache";
|
|
61
|
+
export interface GuardedStateWriterOptions extends StateWriterOptions {
|
|
62
|
+
policy: StateWritePolicy;
|
|
63
|
+
expectedRevision?: number;
|
|
64
|
+
sourceRevision?: number;
|
|
65
|
+
}
|
|
66
|
+
export type GuardedWriteResult = {
|
|
67
|
+
path: string;
|
|
68
|
+
written: true;
|
|
69
|
+
revision: number;
|
|
70
|
+
} | {
|
|
71
|
+
path: string;
|
|
72
|
+
written: false;
|
|
73
|
+
reason: "stale-skip";
|
|
74
|
+
revision: number;
|
|
75
|
+
};
|
|
55
76
|
export interface StateWriterOptions {
|
|
56
77
|
cwd?: string;
|
|
57
78
|
receipt?: StateWriterReceiptContext;
|
|
58
79
|
audit?: StateWriterAuditContext;
|
|
80
|
+
sourceRevision?: number;
|
|
59
81
|
/**
|
|
60
82
|
* Cross-process lock tuning for read-modify-write paths that route through
|
|
61
83
|
* `withWorkflowStateLock` / `updateJsonAtomic`. Omit for the hardened
|
|
@@ -63,6 +85,12 @@ export interface StateWriterOptions {
|
|
|
63
85
|
*/
|
|
64
86
|
lock?: FileLockOptions;
|
|
65
87
|
}
|
|
88
|
+
export declare class StateWriteConflictError extends Error {
|
|
89
|
+
readonly path: string;
|
|
90
|
+
readonly expectedRevision: number;
|
|
91
|
+
readonly persistedRevision: number;
|
|
92
|
+
constructor(path: string, expectedRevision: number, persistedRevision: number);
|
|
93
|
+
}
|
|
66
94
|
export interface DeleteIfOwnedOptions extends StateWriterOptions {
|
|
67
95
|
predicate?: (current: unknown) => boolean | Promise<boolean>;
|
|
68
96
|
}
|
|
@@ -113,6 +141,9 @@ export declare function readExistingStateForMutation(filePath: string): Promise<
|
|
|
113
141
|
export declare function workflowEnvelopeContentSha256(value: unknown): string;
|
|
114
142
|
export declare function stampWorkflowEnvelopeChecksum<T>(value: T, filePath: string, computedAt?: string): T;
|
|
115
143
|
export declare function detectWorkflowEnvelopeIntegrityMismatch(filePath: string): Promise<WorkflowEnvelopeIntegrityMismatch | undefined>;
|
|
144
|
+
export declare function persistedStateRevision(value: unknown): number;
|
|
145
|
+
export declare function writeGuardedJsonAtomic(targetPath: string, value: unknown, options: GuardedStateWriterOptions): Promise<GuardedWriteResult>;
|
|
146
|
+
export declare function writeGuardedWorkflowEnvelopeAtomic(targetPath: string, value: unknown, options: GuardedStateWriterOptions): Promise<GuardedWriteResult>;
|
|
116
147
|
export declare function writeJsonAtomic(targetPath: string, value: unknown, options?: StateWriterOptions): Promise<string>;
|
|
117
148
|
export declare function writeWorkflowEnvelopeAtomic(targetPath: string, value: unknown, options?: StateWriterOptions): Promise<string>;
|
|
118
149
|
export declare function writeTextAtomic(targetPath: string, text: string, options?: StateWriterOptions): Promise<string>;
|
|
@@ -178,8 +209,7 @@ export declare function createJsonNoClobber(targetPath: string, value: unknown,
|
|
|
178
209
|
export declare function deleteIfOwned(targetPath: string, predicateOrOptions?: ((current: unknown) => boolean | Promise<boolean>) | DeleteIfOwnedOptions): Promise<DeleteResult>;
|
|
179
210
|
export declare function removeFileAudited(targetPath: string, options?: StateWriterOptions): Promise<DeleteResult>;
|
|
180
211
|
/**
|
|
181
|
-
* Active entry files under `.gjc/state/active/<skill>.json`
|
|
182
|
-
* `.gjc/state/sessions/<id>/active/<skill>.json` are authoritative. The
|
|
212
|
+
* Active entry files under `.gjc/_session-{id}/state/active/<skill>.json` are authoritative. The
|
|
183
213
|
* adjacent `skill-active-state.json` file is only a derived cache rebuilt from
|
|
184
214
|
* those entries, so concurrent snapshot rebuilds can race without losing any
|
|
185
215
|
* writer's per-skill state.
|
|
@@ -196,14 +226,15 @@ export declare function softDelete(targetPath: string, meta: Record<string, unkn
|
|
|
196
226
|
export declare function hardPruneJson(targetPaths: readonly string[], selector: HardPruneSelector, options?: StateWriterOptions): Promise<string[]>;
|
|
197
227
|
export declare function hardPrune(targets: readonly GenericHardPruneTarget[], selector: GenericHardPruneSelector, options?: StateWriterOptions): Promise<string[]>;
|
|
198
228
|
export declare function forceOverwrite(targetPath: string, rawValue: unknown, options?: ForceOverwriteOptions): Promise<string>;
|
|
199
|
-
export declare function appendAuditEntry(cwd: string,
|
|
200
|
-
export declare function readWorkflowTransactionJournal(cwd: string, mutationId: string): Promise<WorkflowTransactionJournal | undefined>;
|
|
229
|
+
export declare function appendAuditEntry(cwd: string, sessionIdOrEntry: string | AuditEntry, maybeEntry?: AuditEntry): Promise<string>;
|
|
230
|
+
export declare function readWorkflowTransactionJournal(cwd: string, sessionId: string, mutationId: string): Promise<WorkflowTransactionJournal | undefined>;
|
|
201
231
|
export declare function beginWorkflowTransactionJournal(input: {
|
|
202
232
|
cwd: string;
|
|
233
|
+
sessionId: string;
|
|
203
234
|
mutationId: string;
|
|
204
235
|
caller?: CanonicalGjcWorkflowSkill;
|
|
205
236
|
callee?: CanonicalGjcWorkflowSkill;
|
|
206
237
|
paths: string[];
|
|
207
238
|
}): Promise<string>;
|
|
208
|
-
export declare function updateWorkflowTransactionJournal(cwd: string, mutationId: string, patch: Partial<WorkflowTransactionJournal>): Promise<string>;
|
|
209
|
-
export declare function completeWorkflowTransactionJournal(cwd: string, mutationId: string): Promise<void>;
|
|
239
|
+
export declare function updateWorkflowTransactionJournal(cwd: string, sessionId: string, mutationId: string, patch: Partial<WorkflowTransactionJournal>): Promise<string>;
|
|
240
|
+
export declare function completeWorkflowTransactionJournal(cwd: string, sessionId: string, mutationId: string): Promise<void>;
|
|
@@ -27,10 +27,25 @@ export declare function validateCompletionReceipt(input: {
|
|
|
27
27
|
export declare function readUltragoalVerificationState(input: {
|
|
28
28
|
cwd: string;
|
|
29
29
|
currentGoal?: CurrentGoalLike | null;
|
|
30
|
+
sessionId?: string | null;
|
|
30
31
|
}): Promise<UltragoalGuardDiagnostic>;
|
|
31
32
|
export declare function isUltragoalAskBlocked(cwd: string): Promise<UltragoalAskBlockDiagnostic>;
|
|
32
33
|
export declare function assertCanCompleteCurrentGoal(input: {
|
|
33
34
|
cwd: string;
|
|
34
35
|
currentGoal?: CurrentGoalLike | null;
|
|
36
|
+
sessionId?: string | null;
|
|
35
37
|
}): Promise<void>;
|
|
36
38
|
export declare function isUltragoalBypassPrompt(prompt: string): boolean;
|
|
39
|
+
export interface UltragoalPauseBlockDiagnostic {
|
|
40
|
+
blocked: boolean;
|
|
41
|
+
reason: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* While an Ultragoal run is active, `goal({"op":"pause"})` is only allowed when the
|
|
45
|
+
* current durable Ultragoal state is readable and the latest durable ledger event
|
|
46
|
+
* classifies the current blocker as `human_blocked`. Resolvable blockers must be
|
|
47
|
+
* worked, not parked. Reads fail closed so unreadable durable state or ledger data
|
|
48
|
+
* blocks pause rather than silently allowing a give-up.
|
|
49
|
+
*/
|
|
50
|
+
export declare function isUltragoalPauseBlocked(cwd: string): Promise<UltragoalPauseBlockDiagnostic>;
|
|
51
|
+
export declare function assertUltragoalPauseAllowed(cwd: string): Promise<void>;
|
|
@@ -23,6 +23,7 @@ export interface UltragoalPlan {
|
|
|
23
23
|
goals: UltragoalGoal[];
|
|
24
24
|
createdAt: string;
|
|
25
25
|
updatedAt: string;
|
|
26
|
+
[key: string]: unknown;
|
|
26
27
|
}
|
|
27
28
|
export type UltragoalReceiptKind = "per-goal" | "final-aggregate";
|
|
28
29
|
export interface UltragoalCompletionVerification {
|
|
@@ -79,8 +80,8 @@ interface JsonObject {
|
|
|
79
80
|
[key: string]: unknown;
|
|
80
81
|
}
|
|
81
82
|
export declare function hashStructuredValue(value: unknown): string;
|
|
82
|
-
export declare function getUltragoalPaths(cwd: string): UltragoalPaths;
|
|
83
|
-
export declare function readUltragoalLedger(cwd: string): Promise<UltragoalLedgerEvent[]>;
|
|
83
|
+
export declare function getUltragoalPaths(cwd: string, sessionId?: string | null): UltragoalPaths;
|
|
84
|
+
export declare function readUltragoalLedger(cwd: string, sessionId?: string | null): Promise<UltragoalLedgerEvent[]>;
|
|
84
85
|
export declare function computeUltragoalPlanGeneration(input: {
|
|
85
86
|
plan: UltragoalPlan;
|
|
86
87
|
ledger: readonly UltragoalLedgerEvent[];
|
|
@@ -93,13 +94,14 @@ export declare function computeUltragoalPlanGeneration(input: {
|
|
|
93
94
|
planGeneration: string;
|
|
94
95
|
basis: UltragoalCompletionVerification["basis"];
|
|
95
96
|
};
|
|
96
|
-
export declare function readUltragoalPlan(cwd: string): Promise<UltragoalPlan | null>;
|
|
97
|
-
export declare function getUltragoalStatus(cwd: string): Promise<UltragoalStatusSummary>;
|
|
97
|
+
export declare function readUltragoalPlan(cwd: string, sessionId?: string | null): Promise<UltragoalPlan | null>;
|
|
98
|
+
export declare function getUltragoalStatus(cwd: string, sessionId?: string | null): Promise<UltragoalStatusSummary>;
|
|
98
99
|
export declare function buildUltragoalHudSummary(summary: UltragoalStatusSummary, latestLedger?: UltragoalLedgerEvent): WorkflowHudSummary;
|
|
99
100
|
export declare function createUltragoalPlan(input: {
|
|
100
101
|
cwd: string;
|
|
101
102
|
brief: string;
|
|
102
103
|
gjcGoalMode?: UltragoalGjcGoalMode;
|
|
104
|
+
sessionId?: string | null;
|
|
103
105
|
}): Promise<UltragoalPlan>;
|
|
104
106
|
export interface UltragoalRunCompletionState {
|
|
105
107
|
requiredGoals: UltragoalGoal[];
|
|
@@ -115,6 +117,7 @@ export declare function getUltragoalRunCompletionState(plan: UltragoalPlan, opti
|
|
|
115
117
|
export declare function startNextUltragoalGoal(input: {
|
|
116
118
|
cwd: string;
|
|
117
119
|
retryFailed?: boolean;
|
|
120
|
+
sessionId?: string | null;
|
|
118
121
|
}): Promise<{
|
|
119
122
|
plan: UltragoalPlan;
|
|
120
123
|
goal?: UltragoalGoal;
|
|
@@ -190,6 +193,19 @@ export declare function recordUltragoalReviewBlockers(input: {
|
|
|
190
193
|
evidence: string;
|
|
191
194
|
gjcGoalJson?: string;
|
|
192
195
|
}): Promise<UltragoalPlan>;
|
|
196
|
+
export type UltragoalBlockerClassification = "human_blocked" | "resolvable";
|
|
197
|
+
/**
|
|
198
|
+
* Record an audited blocker triage classification in the durable ledger. A
|
|
199
|
+
* `human_blocked` classification is the only thing that authorizes
|
|
200
|
+
* `goal({"op":"pause"})` while an Ultragoal run is active; `resolvable` is an
|
|
201
|
+
* audit note and never unblocks pause.
|
|
202
|
+
*/
|
|
203
|
+
export declare function recordUltragoalBlockerClassification(input: {
|
|
204
|
+
cwd: string;
|
|
205
|
+
classification: UltragoalBlockerClassification;
|
|
206
|
+
evidence: string;
|
|
207
|
+
goalId?: string;
|
|
208
|
+
}): Promise<UltragoalLedgerEvent>;
|
|
193
209
|
type UltragoalReviewContractStrength = "strong" | "thin-derived";
|
|
194
210
|
interface UltragoalReviewFinding extends JsonObject {
|
|
195
211
|
severity: "blocker";
|
|
@@ -205,6 +221,7 @@ interface UltragoalReviewResult extends JsonObject {
|
|
|
205
221
|
weakContractCapApplied: boolean;
|
|
206
222
|
blockerGoalIds?: string[];
|
|
207
223
|
}
|
|
224
|
+
export declare function resolveGitBase(cwd: string, branch?: string): Promise<string>;
|
|
208
225
|
export declare function runUltragoalReview(cwd: string, args: readonly string[]): Promise<UltragoalReviewResult>;
|
|
209
226
|
export declare function runNativeUltragoalCommand(args: string[], cwd?: string): Promise<UltragoalCommandResult>;
|
|
210
227
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CanonicalGjcWorkflowSkill } from "../skill-state/canonical-skills";
|
|
2
2
|
export type CommandRefVisibility = "public" | "hidden" | "planned";
|
|
3
3
|
export type CommandRefIncludeWhen = "implemented-only" | "planned";
|
|
4
4
|
export interface CommandRefCommand {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Any JSON manifest projection is derived from this module and must never be
|
|
4
4
|
* hand-edited.
|
|
5
5
|
*/
|
|
6
|
-
import type
|
|
6
|
+
import { type CanonicalGjcWorkflowSkill } from "../skill-state/canonical-skills";
|
|
7
7
|
export interface WorkflowState {
|
|
8
8
|
id: string;
|
|
9
9
|
initial?: boolean;
|
|
@@ -29,11 +29,12 @@ export declare class StorageError extends Error {
|
|
|
29
29
|
readonly code: string;
|
|
30
30
|
constructor(message: string, code: string);
|
|
31
31
|
}
|
|
32
|
-
/** Resolve the harness state root from explicit value, env, or cwd default. */
|
|
32
|
+
/** Resolve the harness state root from explicit value, env, or cwd/session default. */
|
|
33
33
|
export declare function resolveHarnessRoot(opts?: {
|
|
34
34
|
root?: string;
|
|
35
35
|
cwd?: string;
|
|
36
36
|
env?: NodeJS.ProcessEnv;
|
|
37
|
+
gjcSessionId?: string;
|
|
37
38
|
}): string;
|
|
38
39
|
export declare function assertSafeSessionId(id: string): void;
|
|
39
40
|
export declare function generateSessionId(prefix?: string): string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { SkillDiscoverySettings } from "../config/skill-settings-defaults";
|
|
2
2
|
import { type SkillActiveState } from "../skill-state/active-state";
|
|
3
|
+
import { initialPhaseForSkill } from "../skill-state/initial-phase";
|
|
4
|
+
export { initialPhaseForSkill };
|
|
3
5
|
import { type GjcWorkflowSkill } from "./skill-keywords";
|
|
4
|
-
export declare const GJC_STATE_DIR = ".gjc
|
|
6
|
+
export declare const GJC_STATE_DIR = ".gjc";
|
|
5
7
|
export declare const SKILL_ACTIVE_STATE_FILE = "skill-active-state.json";
|
|
6
8
|
export interface EffectiveSkillConfigInput {
|
|
7
9
|
skillsSettings?: SkillDiscoverySettings;
|
|
@@ -55,9 +57,15 @@ export interface UserPromptSubmitStateInput {
|
|
|
55
57
|
export declare function detectSkillKeywords(text: string): SkillKeywordMatch[];
|
|
56
58
|
export declare function detectPrimarySkillKeyword(text: string): SkillKeywordMatch | null;
|
|
57
59
|
export declare function resolveGjcStateDir(cwd: string, stateDir?: string): string;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
export interface StateRecoveryDiagnostic {
|
|
61
|
+
kind: "skill-active-state" | "mode-state";
|
|
62
|
+
statePath: string;
|
|
63
|
+
reason: "missing" | "corrupt" | "unreadable";
|
|
64
|
+
skill?: GjcWorkflowSkill;
|
|
65
|
+
}
|
|
66
|
+
export declare function buildStateRecoveryDiagnosticsContext(diagnostics: readonly StateRecoveryDiagnostic[]): string | null;
|
|
67
|
+
export declare function collectUserPromptStateRecoveryDiagnostics(input: UserPromptSubmitStateInput): Promise<StateRecoveryDiagnostic[]>;
|
|
68
|
+
export declare function readVisibleSkillActiveState(cwd: string, sessionId?: string, _stateDir?: string): Promise<SkillActiveState | null>;
|
|
61
69
|
export declare function recordSkillActivation(input: RecordSkillActivationInput): Promise<SkillActiveState | null>;
|
|
62
70
|
export interface EnsureWorkflowSkillActivationInput {
|
|
63
71
|
cwd: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AdapterResult, MigrateAction, MigrateDestinations, MigrateWarning } from "./types";
|
|
2
|
+
export interface PlanInput {
|
|
3
|
+
results: AdapterResult[];
|
|
4
|
+
destinations: MigrateDestinations;
|
|
5
|
+
force: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface PlanOutput {
|
|
8
|
+
actions: MigrateAction[];
|
|
9
|
+
warnings: MigrateWarning[];
|
|
10
|
+
}
|
|
11
|
+
export declare function planMigration(input: PlanInput): Promise<PlanOutput>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AdapterResult, MigrateSource, SkillCandidate, SourceDiagnostic } from "../types";
|
|
2
|
+
export interface AdapterOptions {
|
|
3
|
+
/** Home directory root; overridable for tests. */
|
|
4
|
+
homeDir: string;
|
|
5
|
+
}
|
|
6
|
+
export interface Adapter {
|
|
7
|
+
source: MigrateSource;
|
|
8
|
+
collect(options: AdapterOptions): Promise<AdapterResult>;
|
|
9
|
+
}
|
|
10
|
+
export declare function getAdapter(source: MigrateSource): Adapter;
|
|
11
|
+
/** Read a text file, classifying absence/IO errors into source diagnostics. */
|
|
12
|
+
export declare function readSourceText(filePath: string, source: MigrateSource, type: SourceDiagnostic["type"]): Promise<{
|
|
13
|
+
text: string;
|
|
14
|
+
} | {
|
|
15
|
+
diagnostic: SourceDiagnostic;
|
|
16
|
+
}>;
|
|
17
|
+
/** Parse JSON text, classifying parse errors into a `failed_invalid_source` diagnostic. */
|
|
18
|
+
export declare function parseSourceJson(text: string, filePath: string, source: MigrateSource, type: SourceDiagnostic["type"]): {
|
|
19
|
+
data: Record<string, unknown>;
|
|
20
|
+
} | {
|
|
21
|
+
diagnostic: SourceDiagnostic;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Collect skill candidates from a directory of `<name>/SKILL.md` entries.
|
|
25
|
+
* A missing directory yields a `skipped_absent_source` diagnostic.
|
|
26
|
+
*/
|
|
27
|
+
export declare function collectSkillDir(dir: string, source: MigrateSource): Promise<{
|
|
28
|
+
candidates: SkillCandidate[];
|
|
29
|
+
diagnostics: SourceDiagnostic[];
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Collect skill candidates from a flat directory of `*.md` prompt/command files.
|
|
33
|
+
*/
|
|
34
|
+
export declare function collectMarkdownPrompts(dir: string, source: MigrateSource): Promise<{
|
|
35
|
+
candidates: SkillCandidate[];
|
|
36
|
+
diagnostics: SourceDiagnostic[];
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Recursively collect skill candidates from any `**/SKILL.md` under `root`.
|
|
40
|
+
* The slug derives from the directory that directly contains the `SKILL.md`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function collectSkillTree(root: string, source: MigrateSource): Promise<{
|
|
43
|
+
candidates: SkillCandidate[];
|
|
44
|
+
diagnostics: SourceDiagnostic[];
|
|
45
|
+
}>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map raw source MCP server entries onto GJC `MCPServerConfig`.
|
|
3
|
+
*
|
|
4
|
+
* Implements the source-schema compatibility matrix from the consensus plan:
|
|
5
|
+
* preserved (P), transformed (T), omitted-with-warning (OW), skipped (S,
|
|
6
|
+
* `skipped_unmappable`), and failed (F, `failed_invalid_source`). Secret-indirection
|
|
7
|
+
* fields are always omitted-with-warning; their values are never read or emitted.
|
|
8
|
+
*/
|
|
9
|
+
import type { MCPServerConfig } from "../runtime-mcp/types";
|
|
10
|
+
import type { MigrateSource } from "./types";
|
|
11
|
+
export type McpMapOutcome = {
|
|
12
|
+
ok: true;
|
|
13
|
+
config: MCPServerConfig;
|
|
14
|
+
warnings: string[];
|
|
15
|
+
} | {
|
|
16
|
+
ok: false;
|
|
17
|
+
status: "skipped_unmappable" | "failed_invalid_source";
|
|
18
|
+
reason: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function mapMcpEntry(source: MigrateSource, name: string, raw: unknown): McpMapOutcome;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the human-readable and `--json` reports for `gjc migrate`.
|
|
3
|
+
*
|
|
4
|
+
* Secret values are never read upstream, so the report only ever contains field
|
|
5
|
+
* names in warnings — but rendering still treats action/warning text as opaque.
|
|
6
|
+
*/
|
|
7
|
+
import { type MigrateAction, type MigrateDestinations, type MigrateReport, type MigrateSource, type MigrateWarning } from "./types";
|
|
8
|
+
export interface BuildReportInput {
|
|
9
|
+
actions: MigrateAction[];
|
|
10
|
+
warnings: MigrateWarning[];
|
|
11
|
+
sources: MigrateSource[];
|
|
12
|
+
destinations: MigrateDestinations;
|
|
13
|
+
dryRun: boolean;
|
|
14
|
+
project: boolean;
|
|
15
|
+
force: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function buildReport(input: BuildReportInput): MigrateReport;
|
|
18
|
+
export declare function renderHuman(report: MigrateReport): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize a skill from another agent into a native GJC `SKILL.md`.
|
|
3
|
+
*
|
|
4
|
+
* GJC derives a skill's loaded name from its directory (`<slug>/SKILL.md`) when no
|
|
5
|
+
* frontmatter `name` is present, and requires a `description`. To guarantee the
|
|
6
|
+
* effective loaded name equals the lowercase-hyphen slug, we drop any frontmatter
|
|
7
|
+
* `name` and place the file at `<slug>/SKILL.md`, synthesizing a `description`
|
|
8
|
+
* when the source lacks one.
|
|
9
|
+
*/
|
|
10
|
+
export interface NormalizeSkillInput {
|
|
11
|
+
/** Raw name from the source (filename stem, frontmatter name, etc.). */
|
|
12
|
+
rawName: string;
|
|
13
|
+
/** Full source markdown (may or may not have frontmatter). */
|
|
14
|
+
content: string;
|
|
15
|
+
}
|
|
16
|
+
export interface NormalizedSkill {
|
|
17
|
+
slug: string;
|
|
18
|
+
content: string;
|
|
19
|
+
warnings: string[];
|
|
20
|
+
}
|
|
21
|
+
/** Convert an arbitrary name into a lowercase-hyphen slug. */
|
|
22
|
+
export declare function slugify(name: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Produce a `{ slug, content }` pair whose effective GJC-loaded name equals `slug`.
|
|
25
|
+
* Throws only on an unusable name (cannot produce a slug).
|
|
26
|
+
*/
|
|
27
|
+
export declare function normalizeSkill(input: NormalizeSkillInput): NormalizedSkill;
|