@kriya-ai/harness 2.0.0 → 2.1.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/bin/kriya.js CHANGED
@@ -6,6 +6,7 @@ import { handoff, HandoffError, pull } from "../plugins/kriya-handoff/index.js"
6
6
  import { KriyaError, me, revokeDevice } from "../src/api.js"
7
7
  import { doctor, nodeOk } from "../src/doctor.js"
8
8
  import { runDsh } from "../src/launch.js"
9
+ import { localModelArgs } from "../src/local-model.js"
9
10
  import { daemonPidFile, runDaemon, serviceDefinition } from "../src/daemon.js"
10
11
  import { serve, servedFolder, ServeError } from "../src/world.js"
11
12
  import { HEAVY_CATALOG, linkSkills, SKILL_ROOTS, skillsDir, SkillsError, unlinkSkill, visibleSkills } from "../src/local-skills.js"
@@ -31,7 +32,11 @@ const HELP = `Kriya Harness (beta)
31
32
  Usage:
32
33
  kriya login [--url <your Kriya address>] [--no-browser]
33
34
  kriya [--mode <mode>] [--no-loop] [--loop-v2] [--loop-guard] [--strict-loop] [--defensive] [--recon] [--jit-tools] [--no-browser-tools] [--router] [--no-budget] [--anchor] [--no-open] [--port <n>]
35
+ [--local-model [<url>]] [--local-model-name <name>]
34
36
  open the agent in your browser (local, 127.0.0.1)
37
+ --local-model: a model on this computer (Ollama or LM Studio, found
38
+ by itself, or <url> on your network) builds; Kriya's model plans
39
+ and reviews. Needs the orchestra and your Kriya owner's switch
35
40
  kriya run [--mode <mode>] [--no-loop] [--loop-v2] [--loop-guard] [--strict-loop] [--defensive] [--recon] [--jit-tools] [--no-browser-tools] [--router] [--no-budget] [--anchor] "<job>"
36
41
  run one job and print the answer (--json for events)
37
42
  kriya acp the agent for editors: an ACP server on stdin/stdout
@@ -58,9 +63,11 @@ Usage:
58
63
  bring a workspace's changes back on a new branch
59
64
  kriya/pull-<id> (default: your last handoff)
60
65
  kriya daemon [--folder <path>]… [--allow-full-access] [--allow-serve] [--allow-edit]
66
+ [--local-model [<url>]] [--local-model-name <name>]
61
67
  let Kriya (/harness, your phone) run tasks, health checks,
62
68
  rule decisions, handoff and pull on this computer, in this
63
- folder and each --folder only, while it runs
69
+ folder and each --folder only, while it runs; with
70
+ --local-model, those tasks build on this computer's model
64
71
  kriya daemon install [same options]
65
72
  keep it running in the background (launchd / systemd)
66
73
  kriya daemon uninstall
@@ -193,7 +200,8 @@ function option(args, name) {
193
200
  }
194
201
 
195
202
  // The loop, budget and kept-request switches (src/modes.js switchEnv)
196
- const useLoop = (args) => switchEnv(args)
203
+ // and --local-model [url] / --local-model-name <name> (S-1, src/local-model.js)
204
+ const useLoop = (args) => (switchEnv(args), localModelArgs(args))
197
205
 
198
206
  function signedIn() {
199
207
  const device = readDevice()
@@ -580,13 +588,17 @@ async function main(argv) {
580
588
  let allowFullAccess = false
581
589
  let allowServe = false
582
590
  let allowEdit = false
591
+ // S-1/S-3: tasks from Kriya build on this computer's model too (src/local-model.js); the child runs inherit it
592
+ localModelArgs(args)
593
+ const local = process.env.KRIYA_LOCAL_MODEL
594
+ const localFlags = local && local !== "off" ? ["--local-model", ...(local === "on" ? [] : [local]), ...(process.env.KRIYA_LOCAL_MODEL_NAME ? ["--local-model-name", process.env.KRIYA_LOCAL_MODEL_NAME] : [])] : []
583
595
  for (let i = 0; i < args.length; i++) {
584
596
  if (args[i] === "--folder" && args[i + 1]) folders.push(args[++i])
585
597
  else if (args[i] === "--allow-full-access") allowFullAccess = true
586
598
  else if (args[i] === "--allow-serve") allowServe = true
587
599
  else if (args[i] === "--allow-edit") allowEdit = true
588
600
  else {
589
- say("Usage: kriya daemon [install|uninstall] [--folder <path>]… [--allow-full-access] [--allow-serve] [--allow-edit]")
601
+ say("Usage: kriya daemon [install|uninstall] [--folder <path>]… [--allow-full-access] [--allow-serve] [--allow-edit] [--local-model [<url>]] [--local-model-name <name>]")
590
602
  return 1
591
603
  }
592
604
  }
@@ -598,7 +610,7 @@ async function main(argv) {
598
610
  const { dirname } = await import("node:path")
599
611
  const service = serviceDefinition({
600
612
  bin: new URL(import.meta.url).pathname,
601
- args: [...offered.flatMap((f) => ["--folder", f]), ...(allowFullAccess ? ["--allow-full-access"] : []), ...(allowServe ? ["--allow-serve"] : []), ...(allowEdit ? ["--allow-edit"] : [])],
613
+ args: [...offered.flatMap((f) => ["--folder", f]), ...(allowFullAccess ? ["--allow-full-access"] : []), ...(allowServe ? ["--allow-serve"] : []), ...(allowEdit ? ["--allow-edit"] : []), ...localFlags],
602
614
  })
603
615
  if (!service) {
604
616
  say("kriya daemon install supports macOS (launchd) and Linux (systemd). Run kriya daemon in a terminal instead.")
@@ -714,6 +726,8 @@ async function main(argv) {
714
726
  case "--no-budget":
715
727
  case "--no-anchor":
716
728
  case "--no-open":
729
+ case "--local-model":
730
+ case "--local-model-name":
717
731
  case "--port": {
718
732
  // Only these Web UI flags pass through; never --host, so the UI stays on 127.0.0.1
719
733
  const flags = command === undefined ? [] : [command, ...args]
@@ -29,14 +29,29 @@
29
29
  # cap; the others keep DSH's defaults (262,144 and 32,768). A tier
30
30
  # Kriya says takes images (KRIYA_MODEL_IMAGES) declares it, else
31
31
  # DSH refuses every image for it
32
+ # Harness 2.0: with the owner's orchestra and the local relay, an
33
+ # "Orchestration" choice first (KRIYA_ORCHESTRA_PICK, from the launcher):
34
+ # the head's limits and images; the relay sends it to Kriya as the head tier
35
+ # S-1: with --local-model and the owner's harness.localModels, a "Local ·
36
+ # <model>" entry last (KRIYA_LOCAL_MODEL_ID, set by the launcher only when
37
+ # it found the server); the relay sends its requests to that server
32
38
  models: !!js >-
33
- ((names, limits) => [['balanced', 'Kriya balanced'], ['budget', 'Kriya budget'], ['escalation', 'Kriya escalation']]
39
+ ((names, limits) => [...(process.env.KRIYA_ORCHESTRA_PICK && process.env.KRIYA_ORCHESTRA_HEAD ? [[process.env.KRIYA_ORCHESTRA_PICK, process.env.KRIYA_ORCHESTRA_NAME || 'Orchestration', process.env.KRIYA_ORCHESTRA_HEAD]] : []),
40
+ ...[['balanced', 'Kriya balanced'], ['budget', 'Kriya budget'], ['escalation', 'Kriya escalation']]
34
41
  .filter(([id]) => (process.env.KRIYA_ALLOWED_TIERS || 'balanced,budget,escalation').split(',').includes(id))
35
- .map(([id, name]) => ({ id, name: typeof names[id] === 'string' && names[id] ? names[id] : name,
36
- ...((process.env.KRIYA_MODEL_IMAGES || '').split(',').includes(id) ? { input: ['text', 'image'] } : {}),
37
- ...(limits[id] ? { contextWindow: limits[id].contextWindow, maxTokens: limits[id].maxTokens } : {}) })))
42
+ .map(([id, name]) => [id, typeof names[id] === 'string' && names[id] ? names[id] : name, id])]
43
+ .map(([id, name, tier]) => ({ id, name,
44
+ ...((process.env.KRIYA_MODEL_IMAGES || '').split(',').includes(tier) ? { input: ['text', 'image'] } : {}),
45
+ ...(limits[tier] ? { contextWindow: limits[tier].contextWindow, maxTokens: limits[tier].maxTokens } : {}) }))
46
+ .concat(process.env.KRIYA_LOCAL_MODEL_ID ? [{ id: 'local', name: process.env.KRIYA_LOCAL_MODEL_LABEL || 'Local model',
47
+ contextWindow: Math.min(1048576, Math.max(16384, Math.floor(Number(process.env.KRIYA_LOCAL_CONTEXT)) || 32768)), maxTokens: 8192 }] : [])
48
+ .concat((() => { try { return JSON.parse(process.env.KRIYA_OWN_MODELS || '[]') } catch { return [] } })()
49
+ .filter((m) => m && typeof m.id === 'string' && limits[m.id]).map((m) => ({ id: m.id, name: String(m.name || m.id), contextWindow: limits[m.id].contextWindow, maxTokens: limits[m.id].maxTokens }))))
38
50
  ((() => { try { return JSON.parse(process.env.KRIYA_MODEL_NAMES || '{}') } catch { return {} } })(),
39
- (() => { try { return JSON.parse(process.env.KRIYA_MODEL_LIMITS || '{}') } catch { return {} } })())
51
+ Object.assign((() => { try { return JSON.parse(process.env.KRIYA_MODEL_LIMITS || '{}') } catch { return {} } })(),
52
+ Object.fromEntries((() => { try { return JSON.parse(process.env.KRIYA_OWN_MODELS || '[]') } catch { return [] } })()
53
+ .filter((m) => m && typeof m.id === 'string' && /^own-\d{1,3}$/.test(m.id))
54
+ .map((m) => [m.id, ((w) => ({ contextWindow: w, maxTokens: Math.min(16384, Math.floor(w / 4)), headroomTokens: Math.floor(w / 4) }))(Math.min(2000000, Math.max(16384, Math.floor(Number(m.contextWindow)) || 131072)))]))))
40
55
 
41
56
  # Harness upgrade U3: compaction headroom per tier from the same limits, so
42
57
  # DSH's trigger (W − O − headroom) stays positive on a small window. No
@@ -44,8 +59,13 @@
44
59
  - id: compaction-basic
45
60
  config:
46
61
  modelPolicies: !!js >-
47
- Object.entries((() => { try { return JSON.parse(process.env.KRIYA_MODEL_LIMITS || '{}') } catch { return {} } })())
48
- .map(([model, l]) => ({ provider: 'kriya', model, headroomTokens: l.headroomTokens }))
62
+ Object.entries(Object.assign((() => { try { return JSON.parse(process.env.KRIYA_MODEL_LIMITS || '{}') } catch { return {} } })(),
63
+ Object.fromEntries((() => { try { return JSON.parse(process.env.KRIYA_OWN_MODELS || '[]') } catch { return [] } })()
64
+ .filter((m) => m && typeof m.id === 'string' && /^own-\d{1,3}$/.test(m.id))
65
+ .map((m) => [m.id, { headroomTokens: Math.floor(Math.min(2000000, Math.max(16384, Math.floor(Number(m.contextWindow)) || 131072)) / 4) }]))))
66
+ .flatMap(([model, l]) => [model, ...(process.env.KRIYA_ORCHESTRA_PICK && process.env.KRIYA_ORCHESTRA_HEAD === model ? [process.env.KRIYA_ORCHESTRA_PICK] : [])]
67
+ .map((id) => ({ provider: 'kriya', model: id, headroomTokens: l.headroomTokens })))
68
+ .concat(process.env.KRIYA_LOCAL_MODEL_ID ? [{ provider: 'kriya', model: 'local', headroomTokens: Math.floor(Math.min(1048576, Math.max(16384, Math.floor(Number(process.env.KRIYA_LOCAL_CONTEXT)) || 32768)) / 4) }] : [])
49
69
 
50
70
  # The starting tier: balanced, or the best tier the plan allows, chosen by
51
71
  # the launcher from GET /models (src/launch.js startTier)
@@ -135,6 +155,17 @@
135
155
  # Web UI only: it needs the web server's connection, which the other profiles lack
136
156
  disabled: !!js ctx.get('profileContext')?.name !== 'kriya'
137
157
 
158
+ # The workspace folder chooser (plugins/directory-picker): DSH's adaptive
159
+ # chooser, but on macOS the panel opens next to the last folder picked, else
160
+ # in ~/Developer, instead of wherever the last panel was. Same decision, same
161
+ # client surface; only the kriya profile has the row
162
+ - id: directory-picker
163
+ disabled: true
164
+ - insert:
165
+ - id: kriya-directory-picker
166
+ name: '@kriya-ai/harness-directory-picker'
167
+ disabled: !!js ctx.get('profileContext')?.name !== 'kriya'
168
+
138
169
  # The Editing Studio row (plugins/edit, track E): an "Editing Studio" row in the
139
170
  # sidebar that opens the Edit Host's own Studio app in the same tab, through one
140
171
  # route inside Connection's fence. Off unless kriya was started with --edit
@@ -194,6 +225,24 @@
194
225
  name: '@kriya-ai/harness-repo'
195
226
  disabled: !!js process.env.KRIYA_REPO_TOOLS !== 'on'
196
227
 
228
+ # Own models (plugins/keyguard; Kriya-Tavi docs/kriya-harness/OWN_MODELS.md):
229
+ # the person's API keys never reach a model. Redacted by hash from every tool
230
+ # result, and the key file refused to tools. Only with saved keys
231
+ # (KRIYA_KEY_HASHES from the launcher); otherwise it registers nothing
232
+ - insert:
233
+ - id: kriya-keyguard
234
+ name: '@kriya-ai/harness-keyguard'
235
+ disabled: !!js (process.env.KRIYA_KEY_HASHES || '') === ''
236
+
237
+ # Supabase and Render tools (plugins/providers; Kriya-Tavi docs/kriya-harness/
238
+ # DEVELOPER_COCKPIT.md §4): reads through the person's own CLIs run freely; the
239
+ # one write (local migrations) needs approval; no remote database is ever
240
+ # written. Off unless --provider-tools or the Developer tab's switch
241
+ - insert:
242
+ - id: kriya-providers
243
+ name: '@kriya-ai/harness-providers'
244
+ disabled: !!js process.env.KRIYA_PROVIDER_TOOLS !== 'on'
245
+
197
246
  # Harness 2.0 W16, MCP P3a (plugins/mcp): the owner's registry servers that need
198
247
  # no sign-in, each tool registered only if its definition matches the hash the
199
248
  # owner pinned; no token is sent. Off unless kriya was started with --mcp
@@ -283,6 +332,15 @@
283
332
  # Web UI only: it needs the web server's connection, which the other profiles lack
284
333
  disabled: !!js ctx.get('profileContext')?.name !== 'kriya'
285
334
 
335
+ # The Developer tab (plugins/cockpit; Kriya-Tavi docs/kriya-harness/
336
+ # DEVELOPER_COCKPIT.md): GitHub, connections through each provider's own CLI,
337
+ # running servers and project health. Off unless KRIYA_COCKPIT=on (the
338
+ # owner's harness.cockpit, or --cockpit); Web UI only
339
+ - insert:
340
+ - id: kriya-cockpit
341
+ name: '@kriya-ai/harness-cockpit'
342
+ disabled: !!js ctx.get('profileContext')?.name !== 'kriya' || process.env.KRIYA_COCKPIT !== 'on'
343
+
286
344
  # Remote Control (plugins/remote): the switch in the Overview tab streams a
287
345
  # session to the person's Kriya and listens for the Control Center while this
288
346
  # app runs, with no command. Without the web server it doesn't start
@@ -7,9 +7,9 @@ again from Kriya and update the hash below in the same change.
7
7
 
8
8
  | Field | Value |
9
9
  | --- | --- |
10
- | Copied | 2026-11-23 (again: Harness 2.0 W13, the `graphics` role, `G-3D`, the `GX-*` and `FE-ASSET-LICENCE` detectors and the `scene_direction` contract; W16, `GET /mcp`; earlier frozen for the Harness 2.0 W12 release: regenerated, identical; again: Harness 2.0 W11, `TurnRequest.cartridgeOutcomes` and `GET /models` `workforce`; W2, the optional `orchestra` field of `GET /models`; W1's `cartridgeIds` and `GET /skills` item fields) |
11
- | From | Kriya repository branch `main` (uncommitted, on `b0ed4c2`) |
12
- | sha256 | `ebfcb72c1a6687e7bed3510be00a81662a2ed6594c1e1a9836cae46b44d6107f` |
10
+ | Copied | 2026-11-24 (again: own models, `POST /own-usage` and `GET /models` `ownModels`; the Developer cockpit, `GET /models` `cockpit`; S-3, `runProof`, the schema of a run's `result.proof`; S-1, the optional `localModels` field of `GET /models`; earlier 2026-11-23: Harness 2.0 W13, the `graphics` role, `G-3D`, the `GX-*` and `FE-ASSET-LICENCE` detectors and the `scene_direction` contract; W16, `GET /mcp`; earlier frozen for the Harness 2.0 W12 release: regenerated, identical; again: Harness 2.0 W11, `TurnRequest.cartridgeOutcomes` and `GET /models` `workforce`; W2, the optional `orchestra` field of `GET /models`; W1's `cartridgeIds` and `GET /skills` item fields) |
11
+ | From | Kriya repository branch `main` (uncommitted, on `1b4a742`) |
12
+ | sha256 | `84a25644fbe011d469e4e321f77893a072063d34e4bd85dc61f9f11abffbebae` |
13
13
 
14
14
  When the Kriya side commits the file, replace "From" with that commit.
15
15
  `tests/contract.test.js` checks the hash, so a hand edit fails.
@@ -301,6 +301,18 @@
301
301
  "workforce": {
302
302
  "type": "number",
303
303
  "const": 1
304
+ },
305
+ "localModels": {
306
+ "type": "number",
307
+ "const": 1
308
+ },
309
+ "cockpit": {
310
+ "type": "number",
311
+ "const": 1
312
+ },
313
+ "ownModels": {
314
+ "type": "number",
315
+ "const": 1
304
316
  }
305
317
  },
306
318
  "required": ["object", "data"],
@@ -1863,6 +1875,67 @@
1863
1875
  },
1864
1876
  "response": null
1865
1877
  },
1878
+ {
1879
+ "method": "POST",
1880
+ "path": "/own-usage",
1881
+ "auth": true,
1882
+ "request": {
1883
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
1884
+ "type": "object",
1885
+ "properties": {
1886
+ "entries": {
1887
+ "minItems": 1,
1888
+ "maxItems": 50,
1889
+ "type": "array",
1890
+ "items": {
1891
+ "type": "object",
1892
+ "properties": {
1893
+ "provider": {
1894
+ "type": "string",
1895
+ "pattern": "^[a-z0-9-]{2,30}$"
1896
+ },
1897
+ "model": {
1898
+ "type": "string",
1899
+ "minLength": 1,
1900
+ "maxLength": 120
1901
+ },
1902
+ "requests": {
1903
+ "type": "integer",
1904
+ "minimum": 1,
1905
+ "maximum": 10000
1906
+ },
1907
+ "inputTokens": {
1908
+ "type": "integer",
1909
+ "minimum": 0,
1910
+ "maximum": 1000000000
1911
+ },
1912
+ "outputTokens": {
1913
+ "type": "integer",
1914
+ "minimum": 0,
1915
+ "maximum": 1000000000
1916
+ },
1917
+ "reportedCostMicroUsd": {
1918
+ "type": "integer",
1919
+ "minimum": 0,
1920
+ "maximum": 1000000000000
1921
+ }
1922
+ },
1923
+ "required": [
1924
+ "provider",
1925
+ "model",
1926
+ "requests",
1927
+ "inputTokens",
1928
+ "outputTokens"
1929
+ ],
1930
+ "additionalProperties": false
1931
+ }
1932
+ }
1933
+ },
1934
+ "required": ["entries"],
1935
+ "additionalProperties": false
1936
+ },
1937
+ "response": null
1938
+ },
1866
1939
  {
1867
1940
  "method": "POST",
1868
1941
  "path": "/live",
@@ -1948,6 +2021,152 @@
1948
2021
  "response": null
1949
2022
  }
1950
2023
  ],
2024
+ "runProof": {
2025
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
2026
+ "type": "object",
2027
+ "properties": {
2028
+ "verdict": {
2029
+ "type": "string",
2030
+ "enum": ["verified", "partial", "failed", "blocked", "not checked"]
2031
+ },
2032
+ "steps": {
2033
+ "maxItems": 12,
2034
+ "type": "array",
2035
+ "items": {
2036
+ "type": "object",
2037
+ "properties": {
2038
+ "n": {
2039
+ "type": "integer",
2040
+ "minimum": 1,
2041
+ "maximum": 99
2042
+ },
2043
+ "title": {
2044
+ "type": "string",
2045
+ "maxLength": 120
2046
+ },
2047
+ "verdict": {
2048
+ "type": "string",
2049
+ "enum": ["pass", "fail", "blocked", "not run"]
2050
+ },
2051
+ "attempts": {
2052
+ "type": "integer",
2053
+ "minimum": 0,
2054
+ "maximum": 99
2055
+ },
2056
+ "builtBy": {
2057
+ "maxItems": 8,
2058
+ "type": "array",
2059
+ "items": {
2060
+ "type": "object",
2061
+ "properties": {
2062
+ "level": {
2063
+ "type": "string",
2064
+ "enum": ["head", "worker", "single"]
2065
+ },
2066
+ "name": {
2067
+ "type": "string",
2068
+ "maxLength": 80
2069
+ },
2070
+ "local": {
2071
+ "type": "boolean",
2072
+ "const": true
2073
+ }
2074
+ },
2075
+ "required": ["level", "name"],
2076
+ "additionalProperties": false
2077
+ }
2078
+ },
2079
+ "gates": {
2080
+ "maxItems": 20,
2081
+ "type": "array",
2082
+ "items": {
2083
+ "type": "object",
2084
+ "properties": {
2085
+ "id": {
2086
+ "type": "string",
2087
+ "pattern": "^G-[A-Z0-9-]{2,20}$"
2088
+ },
2089
+ "status": {
2090
+ "type": "string",
2091
+ "maxLength": 20
2092
+ }
2093
+ },
2094
+ "required": ["id", "status"],
2095
+ "additionalProperties": false
2096
+ }
2097
+ }
2098
+ },
2099
+ "required": ["n", "title", "verdict", "attempts", "builtBy", "gates"],
2100
+ "additionalProperties": false
2101
+ }
2102
+ },
2103
+ "touchedChecks": {
2104
+ "maxItems": 20,
2105
+ "type": "array",
2106
+ "items": {
2107
+ "type": "string",
2108
+ "maxLength": 300
2109
+ }
2110
+ },
2111
+ "changes": {
2112
+ "type": "object",
2113
+ "properties": {
2114
+ "files": {
2115
+ "maxItems": 200,
2116
+ "type": "array",
2117
+ "items": {
2118
+ "type": "object",
2119
+ "properties": {
2120
+ "path": {
2121
+ "type": "string",
2122
+ "minLength": 1,
2123
+ "maxLength": 300
2124
+ },
2125
+ "status": {
2126
+ "type": "string",
2127
+ "enum": ["added", "modified", "deleted", "renamed"]
2128
+ },
2129
+ "added": {
2130
+ "type": "integer",
2131
+ "minimum": 0,
2132
+ "maximum": 9007199254740991
2133
+ },
2134
+ "deleted": {
2135
+ "type": "integer",
2136
+ "minimum": 0,
2137
+ "maximum": 9007199254740991
2138
+ },
2139
+ "binary": {
2140
+ "type": "boolean",
2141
+ "const": true
2142
+ }
2143
+ },
2144
+ "required": ["path", "status"],
2145
+ "additionalProperties": false
2146
+ }
2147
+ },
2148
+ "count": {
2149
+ "type": "integer",
2150
+ "minimum": 0,
2151
+ "maximum": 9007199254740991
2152
+ },
2153
+ "added": {
2154
+ "type": "integer",
2155
+ "minimum": 0,
2156
+ "maximum": 9007199254740991
2157
+ },
2158
+ "deleted": {
2159
+ "type": "integer",
2160
+ "minimum": 0,
2161
+ "maximum": 9007199254740991
2162
+ }
2163
+ },
2164
+ "required": ["files", "count", "added", "deleted"],
2165
+ "additionalProperties": false
2166
+ }
2167
+ },
2168
+ "additionalProperties": false
2169
+ },
1951
2170
  "cartridgeIds": {
1952
2171
  "roles": [
1953
2172
  "frontend",
package/install.sh ADDED
@@ -0,0 +1,187 @@
1
+ #!/bin/sh
2
+ # Kriya Harness installer (S-2, Kriya-Tavi docs/kriya-harness/INSTALLER.md).
3
+ #
4
+ # curl -fsSL https://<your Kriya>/install.sh | sh
5
+ #
6
+ # Installs a private Node runtime and Kriya Harness under ~/.kriya (nothing
7
+ # global: not your Node, npm, nvm or /usr/local), puts `kriya` on your PATH,
8
+ # and opens the sign-in for the Kriya that served this script. Run it again
9
+ # to repair or update. Your sign-in, sessions and settings in ~/.kriya stay.
10
+ #
11
+ # Settings (environment): KRIYA_HOME (default ~/.kriya), KRIYA_NO_MODIFY_PATH=1
12
+ # (don't edit your shell's startup file), KRIYA_NO_LOGIN=1 (don't sign in now).
13
+ #
14
+ # Everything runs inside main, called on the last line, so a download cut off
15
+ # halfway runs nothing.
16
+
17
+ set -eu
18
+
19
+ KRIYA_VERSION="2.0.1"
20
+ NODE_VERSION="24.22.0"
21
+ # The Kriya that served this script fills this in; left as is, no sign-in is started
22
+ KRIYA_URL_DEFAULT="__KRIYA_URL__"
23
+
24
+ # sha256 of each Node release file, from https://nodejs.org/dist/v24.22.0/SHASUMS256.txt
25
+ node_sha256() {
26
+ case "$1" in
27
+ darwin-arm64) echo "6a9724d9b50a5f22b4816cded441b5a8d9ddae546191a5e5b7efa5a5e2ee26d5" ;;
28
+ darwin-x64) echo "495e3f273c645f3c4677d438304cdfc701729ea5dec5728f5c8e76a2dece4b91" ;;
29
+ linux-arm64) echo "b7e7991d5407815adfa74a2a9cd4db683552c8ce32ff4a295c22e972849c3f5d" ;;
30
+ linux-x64) echo "28ea0a438de9a13bd7891fd758eee6c7819ee8af5442dfd8d45bd65e56d4228c" ;;
31
+ *) return 1 ;;
32
+ esac
33
+ }
34
+
35
+ say() { printf 'kriya: %s\n' "$*"; }
36
+ fail() {
37
+ printf 'kriya: %s\n' "$*" >&2
38
+ exit 1
39
+ }
40
+
41
+ platform() {
42
+ os=$(uname -s)
43
+ arch=$(uname -m)
44
+ case "$os" in
45
+ Darwin) os=darwin ;;
46
+ Linux) os=linux ;;
47
+ MINGW* | MSYS* | CYGWIN* | Windows*) fail "Windows: run this inside WSL (wsl --install), then again in its terminal." ;;
48
+ *) fail "Kriya Harness runs on macOS and Linux; this is $os." ;;
49
+ esac
50
+ case "$arch" in
51
+ arm64 | aarch64) arch=arm64 ;;
52
+ x86_64 | amd64) arch=x64 ;;
53
+ *) fail "No Kriya Harness build for $arch processors yet." ;;
54
+ esac
55
+ echo "$os-$arch"
56
+ }
57
+
58
+ sha256_of() {
59
+ if command -v shasum >/dev/null 2>&1; then
60
+ shasum -a 256 "$1" | cut -d' ' -f1
61
+ elif command -v sha256sum >/dev/null 2>&1; then
62
+ sha256sum "$1" | cut -d' ' -f1
63
+ else
64
+ fail "Need shasum or sha256sum to check the download."
65
+ fi
66
+ }
67
+
68
+ install_node() {
69
+ target=$1
70
+ dir="$KRIYA_HOME/runtime/node-v$NODE_VERSION-$target"
71
+ if [ -x "$dir/bin/node" ]; then
72
+ NODE_DIR=$dir
73
+ return
74
+ fi
75
+ expected=$(node_sha256 "$target") || fail "No Node build for $target."
76
+ file="node-v$NODE_VERSION-$target.tar.gz"
77
+ tmp=$(mktemp -d "${TMPDIR:-/tmp}/kriya-install.XXXXXX")
78
+ say "Downloading Node $NODE_VERSION (a private copy for Kriya Harness)…"
79
+ curl -fsSL --proto '=https' --tlsv1.2 "https://nodejs.org/dist/v$NODE_VERSION/$file" -o "$tmp/$file" ||
80
+ { rm -rf "$tmp"; fail "Couldn't download Node from nodejs.org; check your connection and run this again."; }
81
+ actual=$(sha256_of "$tmp/$file")
82
+ if [ "$actual" != "$expected" ]; then
83
+ rm -rf "$tmp"
84
+ fail "The Node download didn't match its published checksum; nothing was installed."
85
+ fi
86
+ tar -xzf "$tmp/$file" -C "$tmp" || { rm -rf "$tmp"; fail "Couldn't unpack Node."; }
87
+ mkdir -p "$KRIYA_HOME/runtime"
88
+ rm -rf "$dir"
89
+ mv "$tmp/node-v$NODE_VERSION-$target" "$dir"
90
+ rm -rf "$tmp"
91
+ NODE_DIR=$dir
92
+ }
93
+
94
+ install_kriya() {
95
+ say "Installing Kriya Harness $KRIYA_VERSION…"
96
+ # The private npm, with the private node first on PATH for any install script
97
+ PATH="$NODE_DIR/bin:$PATH" "$NODE_DIR/bin/npm" install --global --prefix "$KRIYA_HOME/npm" \
98
+ --no-fund --no-audit --loglevel=error "@kriya-ai/harness@$KRIYA_VERSION" ||
99
+ fail "npm couldn't install Kriya Harness; run this again, or see https://docs.npmjs.com/common-errors."
100
+ entry="$KRIYA_HOME/npm/lib/node_modules/@kriya-ai/harness/bin/kriya.js"
101
+ [ -f "$entry" ] || fail "The install finished without Kriya Harness's entry point."
102
+ mkdir -p "$KRIYA_HOME/bin"
103
+ # Written fresh each time, so a repair points at this runtime
104
+ cat >"$KRIYA_HOME/bin/kriya.tmp" <<EOF
105
+ #!/bin/sh
106
+ # Kriya Harness, with its private Node (written by install.sh)
107
+ KRIYA_HOME="\${KRIYA_HOME:-$KRIYA_HOME}"
108
+ export KRIYA_HOME
109
+ exec "$NODE_DIR/bin/node" "$entry" "\$@"
110
+ EOF
111
+ chmod 755 "$KRIYA_HOME/bin/kriya.tmp"
112
+ mv "$KRIYA_HOME/bin/kriya.tmp" "$KRIYA_HOME/bin/kriya"
113
+ }
114
+
115
+ add_to_path() {
116
+ bin="$KRIYA_HOME/bin"
117
+ case ":$PATH:" in *":$bin:"*) return ;; esac
118
+ if [ "${KRIYA_NO_MODIFY_PATH:-}" = "1" ]; then
119
+ say "Add Kriya Harness to your PATH: export PATH=\"$bin:\$PATH\""
120
+ return
121
+ fi
122
+ case "${SHELL:-}" in
123
+ */zsh) rc="$HOME/.zshrc" ;;
124
+ */bash) if [ "$(uname -s)" = Darwin ]; then rc="$HOME/.bash_profile"; else rc="$HOME/.bashrc"; fi ;;
125
+ */fish) rc="" ;;
126
+ *) rc="$HOME/.profile" ;;
127
+ esac
128
+ if [ -z "$rc" ]; then
129
+ say "Add Kriya Harness to your PATH: fish_add_path $bin"
130
+ return
131
+ fi
132
+ if [ -f "$rc" ] && grep -q '# Kriya Harness (install.sh)' "$rc"; then
133
+ :
134
+ else
135
+ printf '\n# Kriya Harness (install.sh)\nexport PATH="%s:$PATH"\n' "$bin" >>"$rc"
136
+ say "Added $bin to your PATH in $rc."
137
+ fi
138
+ ADDED_PATH=1
139
+ }
140
+
141
+ sign_in() {
142
+ url="${KRIYA_URL:-$KRIYA_URL_DEFAULT}"
143
+ case "$url" in
144
+ https://* | http://127.0.0.1:* | http://localhost:*) ;;
145
+ *) return ;;
146
+ esac
147
+ if [ -f "$KRIYA_HOME/device.json" ]; then
148
+ say "Already signed in on this computer; kriya login --url $url switches accounts."
149
+ return
150
+ fi
151
+ if [ "${KRIYA_NO_LOGIN:-}" = "1" ]; then
152
+ say "Sign in when you're ready: kriya login --url $url"
153
+ return
154
+ fi
155
+ say "Signing in to $url…"
156
+ # Never the script's own pipe as input
157
+ # /dev/tty can exist yet fail to open (no terminal: CI, some IDE consoles)
158
+ if { true </dev/tty; } 2>/dev/null; then
159
+ "$KRIYA_HOME/bin/kriya" login --url "$url" </dev/tty || say "Sign in later with: kriya login --url $url"
160
+ else
161
+ "$KRIYA_HOME/bin/kriya" login --url "$url" </dev/null || say "Sign in later with: kriya login --url $url"
162
+ fi
163
+ }
164
+
165
+ main() {
166
+ [ -n "${HOME:-}" ] || fail "HOME isn't set."
167
+ command -v curl >/dev/null 2>&1 || fail "Need curl."
168
+ command -v tar >/dev/null 2>&1 || fail "Need tar."
169
+ KRIYA_HOME="${KRIYA_HOME:-$HOME/.kriya}"
170
+ # Private, as kriya keeps it (src/store.js ensureHome): the sign-in lives here
171
+ mkdir -p "$KRIYA_HOME"
172
+ chmod 700 "$KRIYA_HOME"
173
+ ADDED_PATH=0
174
+ target=$(platform)
175
+ install_node "$target"
176
+ install_kriya
177
+ add_to_path
178
+ sign_in
179
+ say "Done. Kriya Harness $KRIYA_VERSION is installed."
180
+ if [ "$ADDED_PATH" = 1 ]; then
181
+ say "Open a new terminal (or run: export PATH=\"$KRIYA_HOME/bin:\$PATH\"), then: cd your-project && kriya"
182
+ else
183
+ say "Next: cd your-project && kriya"
184
+ fi
185
+ }
186
+
187
+ main "$@"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kriya-ai/harness",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Kriya Harness (beta): a Kriya agent on your machine, built on DeepSeek Harness",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,6 +20,7 @@
20
20
  "plugins/",
21
21
  "contract/",
22
22
  "studio/dist/",
23
+ "install.sh",
23
24
  "SAFETY.md",
24
25
  "RELEASE_NOTES.md",
25
26
  "THIRD_PARTY_NOTICES.md",