@kody-ade/kody-engine 0.4.204 → 0.4.206-next.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.
@@ -42,6 +42,14 @@ export interface Profile {
42
42
  * executables differently by category.
43
43
  */
44
44
  role: "primitive" | "orchestrator" | "container" | "watch" | "utility"
45
+ /**
46
+ * A duty is the WHY/WHEN layer: it references an executable (the HOW) by name
47
+ * rather than embedding it. When set, the loader resolves that executable's
48
+ * full profile (claudeCode/scripts/prompt/agents) and overlays this duty's
49
+ * name + staff (WHO) + every (WHEN) + mentions. Absent → this profile IS an
50
+ * executable (defines its own how). executable = how, staff = who, duty = why.
51
+ */
52
+ executable?: string
45
53
  /**
46
54
  * Execution model — orthogonal to `role`.
47
55
  * `oneshot` (default): single invocation on demand.
@@ -429,3 +437,43 @@ export type PostflightScript = (
429
437
 
430
438
  /** A registered script may be either phase; registry looks it up by name. */
431
439
  export type AnyScript = PreflightScript | PostflightScript
440
+
441
+ // ────────────────────────────────────────────────────────────────────────────
442
+ // Job — the unified execution unit (Phase 1 of the job-model migration).
443
+ //
444
+ // A Job is the single thing the engine executes, regardless of how it was
445
+ // triggered. It REFERENCES the reusable nouns — `executable` (how), `persona`
446
+ // (who), `duty` (why, by slug) — and OWNS its `schedule` (when). Two flavors:
447
+ // - "instant" — run once now (an `@kody <verb>` comment or a manual dispatch)
448
+ // - "scheduled" — fired on `schedule` (cron) by the tick path
449
+ //
450
+ // Fields are optional-heavy on purpose: a comment-minted instant job carries
451
+ // `executable` + inline `why`; a cron-minted scheduled job carries `duty` +
452
+ // `schedule` + `persona`. `runJob` (src/job.ts) lowers a Job onto the existing
453
+ // executor; nothing mints Jobs yet — this is an additive seam.
454
+ // ────────────────────────────────────────────────────────────────────────────
455
+
456
+ export type JobFlavor = "instant" | "scheduled"
457
+
458
+ export interface Job {
459
+ /** How: executable (profile) name to run. 0–1; omitted when intent is
460
+ * agent-only with no specific verb. */
461
+ executable?: string
462
+ /** Why (referenced): a duty slug whose intent drives the run. */
463
+ duty?: string
464
+ /** Why (inline): free-text intent, e.g. an `@kody` comment body. Untrusted —
465
+ * fenced where it enters a prompt, not here. */
466
+ why?: string
467
+ /** Who: a staff persona slug. */
468
+ persona?: string
469
+ /** When: cron expression. Set for scheduled jobs, absent for instant. */
470
+ schedule?: string
471
+ /** The issue/PR number this job acts on, when applicable. */
472
+ target?: number
473
+ /** Args passed through to the executable (mirrors DispatchResult.cliArgs). */
474
+ cliArgs: Record<string, unknown>
475
+ /** Run once now ("instant") or on the schedule ("scheduled"). */
476
+ flavor: JobFlavor
477
+ /** Manual force-run (bypass cadence) for a scheduled job. */
478
+ force?: boolean
479
+ }
@@ -0,0 +1,43 @@
1
+ # syntax=docker/dockerfile:1.7
2
+ #
3
+ # Bundled default Dockerfile.preview — DEV-MODE variant.
4
+ #
5
+ # Previews run `next dev`, NOT `next build` + `next start`. This skips
6
+ # the 5–10 min webpack production compile entirely. Trade-offs:
7
+ # - First request to each route lags 2–5s (compile-on-demand)
8
+ # - Subsequent requests are fast
9
+ # - Memory hungry at runtime (webpack alive)
10
+ # For PR previews this is the right trade — reviewers click a handful
11
+ # of pages, never need prod optimizations. Production stays on Vercel.
12
+ #
13
+ # When BASE_IMAGE is set, deps are inherited from the per-repo base
14
+ # image; the install layer just verifies the lockfile.
15
+
16
+ ARG BASE_IMAGE=node:22-alpine
17
+
18
+ FROM ${BASE_IMAGE}
19
+ WORKDIR /app
20
+
21
+ RUN corepack enable 2>/dev/null || true
22
+
23
+ COPY package.json pnpm-lock.yaml* package-lock.json* yarn.lock* ./
24
+ RUN --mount=type=cache,id=kp-pnpm-store,target=/root/.local/share/pnpm/store \
25
+ --mount=type=cache,id=kp-npm-cache,target=/root/.npm \
26
+ if [ -f pnpm-lock.yaml ]; then pnpm install --frozen-lockfile --ignore-scripts; \
27
+ elif [ -f package-lock.json ]; then npm ci --ignore-scripts; \
28
+ elif [ -f yarn.lock ]; then yarn install --frozen-lockfile --ignore-scripts; \
29
+ else npm install --ignore-scripts; fi
30
+
31
+ # Overwrite source files with the PR's version. node_modules and any
32
+ # prior .next directory from the base image are preserved as warm
33
+ # caches for the dev server's first compile.
34
+ COPY . ./
35
+ RUN mkdir -p public
36
+
37
+ ENV NEXT_TELEMETRY_DISABLED=1
38
+ ENV NODE_ENV=development
39
+ ENV PORT=8080
40
+ ENV HOSTNAME=0.0.0.0
41
+
42
+ EXPOSE 8080
43
+ CMD ["sh", "-c", "if [ -f pnpm-lock.yaml ]; then pnpm exec next dev -H 0.0.0.0 -p 8080; else npx next dev -H 0.0.0.0 -p 8080; fi"]
@@ -0,0 +1,40 @@
1
+ # syntax=docker/dockerfile:1.7
2
+ #
3
+ # Bundled default Dockerfile.preview — PROD-MODE variant.
4
+ #
5
+ # Runs `next build` + `next start` — same shape as Vercel. Slower
6
+ # first build (~5–10 min webpack) but instant per-page response.
7
+ # Pick this mode for repos where reviewers test production-only
8
+ # behaviour (SSG, static optimization, edge runtime parity).
9
+
10
+ ARG BASE_IMAGE=node:22-alpine
11
+
12
+ FROM ${BASE_IMAGE}
13
+ WORKDIR /app
14
+
15
+ RUN corepack enable 2>/dev/null || true
16
+
17
+ COPY package.json pnpm-lock.yaml* package-lock.json* yarn.lock* ./
18
+ RUN --mount=type=cache,id=kp-pnpm-store,target=/root/.local/share/pnpm/store \
19
+ --mount=type=cache,id=kp-npm-cache,target=/root/.npm \
20
+ if [ -f pnpm-lock.yaml ]; then pnpm install --frozen-lockfile --ignore-scripts; \
21
+ elif [ -f package-lock.json ]; then npm ci --ignore-scripts; \
22
+ elif [ -f yarn.lock ]; then yarn install --frozen-lockfile --ignore-scripts; \
23
+ else npm install --ignore-scripts; fi
24
+
25
+ COPY . ./
26
+ RUN mkdir -p public
27
+
28
+ ENV NEXT_TELEMETRY_DISABLED=1
29
+ ENV NODE_ENV=production
30
+ ENV PORT=8080
31
+ ENV HOSTNAME=0.0.0.0
32
+ ENV NODE_OPTIONS="--max-old-space-size=7168"
33
+
34
+ RUN --mount=type=cache,id=kp-next-cache,target=/app/.next/cache \
35
+ if [ -f pnpm-lock.yaml ]; then pnpm exec next build; \
36
+ else npx next build; \
37
+ fi
38
+
39
+ EXPOSE 8080
40
+ CMD ["sh", "-c", "if [ -f pnpm-lock.yaml ]; then pnpm exec next start -H 0.0.0.0 -p 8080; else npx next start -H 0.0.0.0 -p 8080; fi"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.204",
3
+ "version": "0.4.206-next.0",
4
4
  "description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,28 +0,0 @@
1
- {
2
- "name": "brain-serve",
3
- "role": "utility",
4
- "describe": "Long-lived HTTP server that wraps the Kody chat loop and speaks the Brain SSE protocol. Listens on $PORT (default 8080); auth via $BRAIN_API_KEY. Pairs with the Kody-Dashboard /api/kody/chat/brain proxy. Usage: `kody brain-serve` (runs until SIGINT/SIGTERM).",
5
- "inputs": [],
6
- "claudeCode": {
7
- "model": "inherit",
8
- "permissionMode": "acceptEdits",
9
- "maxTurns": null,
10
- "systemPromptAppend": null,
11
- "tools": [],
12
- "hooks": [],
13
- "skills": [],
14
- "commands": [],
15
- "subagents": [],
16
- "plugins": [],
17
- "mcpServers": []
18
- },
19
- "cliTools": [],
20
- "scripts": {
21
- "preflight": [
22
- {
23
- "script": "brainServe"
24
- }
25
- ],
26
- "postflight": []
27
- }
28
- }
@@ -1,28 +0,0 @@
1
- {
2
- "name": "pool-serve",
3
- "role": "utility",
4
- "describe": "Always-on warm-pool owner, co-located on the kody-litellm machine. Supervises the LiteLLM proxy and serves the pool API the dashboard calls to claim a pre-booted, frozen runner. Listens on $POOL_API_PORT (default 4100); auth via $POOL_API_KEY (derived from $KODY_MASTER_KEY). Usage: `kody pool-serve`.",
5
- "inputs": [],
6
- "claudeCode": {
7
- "model": "inherit",
8
- "permissionMode": "acceptEdits",
9
- "maxTurns": null,
10
- "systemPromptAppend": null,
11
- "tools": [],
12
- "hooks": [],
13
- "skills": [],
14
- "commands": [],
15
- "subagents": [],
16
- "plugins": [],
17
- "mcpServers": []
18
- },
19
- "cliTools": [],
20
- "scripts": {
21
- "preflight": [
22
- {
23
- "script": "poolServe"
24
- }
25
- ],
26
- "postflight": []
27
- }
28
- }
@@ -1,28 +0,0 @@
1
- {
2
- "name": "runner-serve",
3
- "role": "utility",
4
- "describe": "Idle HTTP server for a warm-pool one-shot runner. Boots with no issue, listens on $PORT (default 8080), and on an authed POST /run (X-Api-Key/Bearer $RUNNER_API_KEY) clones the repo and runs `kody run --issue N`, then exits so Fly auto_destroy reclaims the machine. Usage: `kody runner-serve`.",
5
- "inputs": [],
6
- "claudeCode": {
7
- "model": "inherit",
8
- "permissionMode": "acceptEdits",
9
- "maxTurns": null,
10
- "systemPromptAppend": null,
11
- "tools": [],
12
- "hooks": [],
13
- "skills": [],
14
- "commands": [],
15
- "subagents": [],
16
- "plugins": [],
17
- "mcpServers": []
18
- },
19
- "cliTools": [],
20
- "scripts": {
21
- "preflight": [
22
- {
23
- "script": "runnerServe"
24
- }
25
- ],
26
- "postflight": []
27
- }
28
- }
@@ -1,28 +0,0 @@
1
- {
2
- "name": "serve",
3
- "role": "utility",
4
- "describe": "Start a LiteLLM proxy and optionally launch an editor pointed at it. Usage: `kody serve` (proxy only), `kody serve vscode`, `kody serve claude`. Long-lived — Ctrl+C to stop.",
5
- "inputs": [],
6
- "claudeCode": {
7
- "model": "inherit",
8
- "permissionMode": "acceptEdits",
9
- "maxTurns": null,
10
- "systemPromptAppend": null,
11
- "tools": [],
12
- "hooks": [],
13
- "skills": [],
14
- "commands": [],
15
- "subagents": [],
16
- "plugins": [],
17
- "mcpServers": []
18
- },
19
- "cliTools": [],
20
- "scripts": {
21
- "preflight": [
22
- {
23
- "script": "serveFlow"
24
- }
25
- ],
26
- "postflight": []
27
- }
28
- }