@kriya-ai/harness 0.0.0-stage → 0.2.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/README.md +379 -2
- package/SAFETY.md +162 -0
- package/THIRD_PARTY_NOTICES.md +7911 -0
- package/bin/kriya.js +577 -0
- package/bundle/cordis.patch.yml +397 -0
- package/contract/SOURCE.md +15 -0
- package/contract/contract.json +1355 -0
- package/package.json +57 -4
- package/plugins/anchor/index.js +56 -0
- package/plugins/anchor/package.json +13 -0
- package/plugins/approvals/index.js +183 -0
- package/plugins/approvals/package.json +13 -0
- package/plugins/brand/DESIGN.md +112 -0
- package/plugins/brand/client.js +826 -0
- package/plugins/brand/index.js +15 -0
- package/plugins/brand/package.json +25 -0
- package/plugins/brand/src/client.js +823 -0
- package/plugins/browser/index.js +218 -0
- package/plugins/browser/package.json +13 -0
- package/plugins/budget/index.js +108 -0
- package/plugins/budget/package.json +13 -0
- package/plugins/changes/client.js +245 -0
- package/plugins/changes/index.js +75 -0
- package/plugins/changes/package.json +22 -0
- package/plugins/edit/client.js +113 -0
- package/plugins/edit/index.js +58 -0
- package/plugins/edit/package.json +23 -0
- package/plugins/fs-freshness/index.js +28 -0
- package/plugins/fs-freshness/package.json +13 -0
- package/plugins/graph/client.js +178 -0
- package/plugins/graph/index.js +4 -0
- package/plugins/graph/package.json +22 -0
- package/plugins/kriya-handoff/index.js +194 -0
- package/plugins/kriya-handoff/package.json +13 -0
- package/plugins/kriya-tools/index.js +189 -0
- package/plugins/kriya-tools/package.json +13 -0
- package/plugins/loop/index.js +743 -0
- package/plugins/loop/package.json +13 -0
- package/plugins/mirror/index.js +235 -0
- package/plugins/mirror/package.json +13 -0
- package/plugins/overview/client.js +276 -0
- package/plugins/overview/index.js +95 -0
- package/plugins/overview/package.json +22 -0
- package/plugins/preview/client.js +337 -0
- package/plugins/preview/index.js +4 -0
- package/plugins/preview/package.json +22 -0
- package/plugins/progress/client.js +290 -0
- package/plugins/progress/index.js +100 -0
- package/plugins/progress/package.json +22 -0
- package/plugins/projects/client.js +249 -0
- package/plugins/projects/index.js +30 -0
- package/plugins/projects/package.json +24 -0
- package/plugins/rea/index.js +256 -0
- package/plugins/rea/package.json +10 -0
- package/plugins/rea/skill/LICENSE +21 -0
- package/plugins/rea/skill/SKILL.md +360 -0
- package/plugins/rea/skill/references/android-applications.md +36 -0
- package/plugins/rea/skill/references/connection-and-recovery.md +127 -0
- package/plugins/rea/skill/references/evidence-workflows.md +71 -0
- package/plugins/rea/skill/references/javascript-applications.md +218 -0
- package/plugins/rea/skill/references/native-and-artifacts.md +297 -0
- package/plugins/rea/skill/references/runtime-observation.md +78 -0
- package/plugins/remote/index.js +297 -0
- package/plugins/remote/package.json +10 -0
- package/plugins/router/index.js +84 -0
- package/plugins/router/package.json +13 -0
- package/plugins/sessions/client.js +68 -0
- package/plugins/sessions/index.js +79 -0
- package/plugins/sessions/package.json +20 -0
- package/plugins/skills/client.js +504 -0
- package/plugins/skills/index.js +166 -0
- package/plugins/skills/package.json +23 -0
- package/src/api.js +97 -0
- package/src/browser.js +286 -0
- package/src/changes.js +191 -0
- package/src/checkpoints.js +313 -0
- package/src/daemon.js +503 -0
- package/src/doctor.js +137 -0
- package/src/edit/core/anchors.js +102 -0
- package/src/edit/core/audio.js +158 -0
- package/src/edit/core/faces.js +99 -0
- package/src/edit/core/ffmpeg.js +258 -0
- package/src/edit/core/handoff.js +220 -0
- package/src/edit/core/history.js +90 -0
- package/src/edit/core/layout.js +92 -0
- package/src/edit/core/mix.js +115 -0
- package/src/edit/core/ops.js +602 -0
- package/src/edit/core/plan.js +266 -0
- package/src/edit/core/project.d.ts +134 -0
- package/src/edit/core/project.js +307 -0
- package/src/edit/core/reframe.js +125 -0
- package/src/edit/core/solver.js +416 -0
- package/src/edit/core/time.js +110 -0
- package/src/edit/core/tonemap.js +57 -0
- package/src/edit/director/ask.js +120 -0
- package/src/edit/director/gateway.js +16 -0
- package/src/edit/director/revise.js +186 -0
- package/src/edit/engine/capabilities.js +33 -0
- package/src/edit/engine/captions.js +154 -0
- package/src/edit/engine/color.js +269 -0
- package/src/edit/engine/confine.js +67 -0
- package/src/edit/engine/dna.js +148 -0
- package/src/edit/engine/index.js +473 -0
- package/src/edit/engine/loudness.js +43 -0
- package/src/edit/engine/media.js +57 -0
- package/src/edit/engine/motion.js +281 -0
- package/src/edit/engine/packs.js +87 -0
- package/src/edit/engine/probe.js +101 -0
- package/src/edit/engine/receipt.js +123 -0
- package/src/edit/engine/tool.js +101 -0
- package/src/edit/gates/copy.js +113 -0
- package/src/edit/gates/index.js +430 -0
- package/src/edit/gates/picture.js +130 -0
- package/src/edit/gates/sound.js +58 -0
- package/src/edit/gates/speech.js +127 -0
- package/src/edit/gates/text.js +196 -0
- package/src/edit/gates/text.swift +22 -0
- package/src/edit/graph/index.js +139 -0
- package/src/edit/graph/journal.js +69 -0
- package/src/edit/graph/scheduler.js +79 -0
- package/src/edit/host/client.js +58 -0
- package/src/edit/host/deliver.js +119 -0
- package/src/edit/host/jobs.js +84 -0
- package/src/edit/host/main.js +135 -0
- package/src/edit/host/paths.js +11 -0
- package/src/edit/host/projects.js +415 -0
- package/src/edit/host/server.js +391 -0
- package/src/edit/host/taste.js +135 -0
- package/src/edit/host/tavi.js +417 -0
- package/src/edit/host/watch.js +141 -0
- package/src/edit/index/db.js +109 -0
- package/src/edit/index/index.js +236 -0
- package/src/edit/index/layers/faces.js +78 -0
- package/src/edit/index/layers/faces.swift +18 -0
- package/src/edit/index/layers/meta.js +35 -0
- package/src/edit/index/layers/music.js +146 -0
- package/src/edit/index/layers/quality.js +120 -0
- package/src/edit/index/layers/retakes.js +132 -0
- package/src/edit/index/layers/screen.js +99 -0
- package/src/edit/index/layers/shots.js +29 -0
- package/src/edit/index/layers/sound.js +42 -0
- package/src/edit/index/layers/words.js +64 -0
- package/src/edit/index/story.js +248 -0
- package/src/edit/index/views.js +71 -0
- package/src/edit/loop/governor.js +112 -0
- package/src/edit/loop/loop.js +69 -0
- package/src/edit/loop/make.js +115 -0
- package/src/edit/loop/repair.js +97 -0
- package/src/edit/loop/replay.js +32 -0
- package/src/edit/recipes/multicam.js +461 -0
- package/src/edit/recipes/reel.js +202 -0
- package/src/edit/recipes/short-from-long.js +237 -0
- package/src/edit/recipes/tutorial.js +137 -0
- package/src/edit/recipes/youtube.js +155 -0
- package/src/edit/runtime/cli.js +126 -0
- package/src/edit/runtime/doctor.js +122 -0
- package/src/edit/runtime/fetch.js +15 -0
- package/src/edit/runtime/licences.js +88 -0
- package/src/edit/runtime/manifest.js +73 -0
- package/src/edit/runtime/setup.js +252 -0
- package/src/failure.js +69 -0
- package/src/gateway-proxy.js +213 -0
- package/src/intent.js +130 -0
- package/src/launch.js +315 -0
- package/src/live.js +81 -0
- package/src/local-skills.js +284 -0
- package/src/login.js +82 -0
- package/src/loop.js +428 -0
- package/src/modes.js +128 -0
- package/src/overview.js +71 -0
- package/src/paths.js +30 -0
- package/src/profiles.js +92 -0
- package/src/projects.js +104 -0
- package/src/recon.js +244 -0
- package/src/rules.js +139 -0
- package/src/runner.bundle.js +21172 -0
- package/src/sentinel.js +248 -0
- package/src/skill-switches.js +130 -0
- package/src/store.js +58 -0
- package/src/strict.js +124 -0
- package/src/verify.js +659 -0
- package/src/world.js +268 -0
- package/studio/dist/index.html +14 -0
- package/studio/dist/studio.css +163 -0
- package/studio/dist/studio.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kriya-ai/harness",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Kriya Harness (beta): a Kriya agent on your machine, built on DeepSeek Harness",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"license": "UNLICENSED",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=24.9"
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"kriya": "bin/kriya.js"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"bin/",
|
|
18
|
+
"src/",
|
|
19
|
+
"bundle/",
|
|
20
|
+
"plugins/",
|
|
21
|
+
"contract/",
|
|
22
|
+
"studio/dist/",
|
|
23
|
+
"SAFETY.md",
|
|
24
|
+
"THIRD_PARTY_NOTICES.md",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"dsh": {
|
|
28
|
+
"bundle": {
|
|
29
|
+
"patch": "./bundle/cordis.patch.yml"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"test": "node --test \"tests/*.test.js\"",
|
|
34
|
+
"test:media": "node --test --test-concurrency=1 --test-timeout=280000 \"tests/edit/media/*.test.js\"",
|
|
35
|
+
"bench:m": "node tests/edit/bench-m/run.js",
|
|
36
|
+
"build:studio": "node studio/build.js",
|
|
37
|
+
"check:pins": "node scripts/check-pins.js",
|
|
38
|
+
"check:seams": "node scripts/check-seams.js",
|
|
39
|
+
"check:notices": "node scripts/notices.js --check",
|
|
40
|
+
"notices": "node scripts/notices.js",
|
|
41
|
+
"dump-config": "node scripts/dump-config.js",
|
|
42
|
+
"check": "npm run check:pins && npm run check:seams && npm run check:notices && npm run check:brand && npm test",
|
|
43
|
+
"release:check": "npm run check:pins && npm run check:seams && node scripts/notices.js --check --strict",
|
|
44
|
+
"sbom": "npm sbom --sbom-format cyclonedx --omit dev --package-lock-only",
|
|
45
|
+
"build:brand": "node scripts/build-brand.js",
|
|
46
|
+
"check:brand": "node scripts/build-brand.js --check"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@deepseek-ai/dsh": "0.2.1-rc.5",
|
|
50
|
+
"playwright-core": "1.64.1"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@fontsource-variable/fraunces": "5.3.0",
|
|
54
|
+
"@fontsource-variable/geist": "5.3.0",
|
|
55
|
+
"@fontsource-variable/jetbrains-mono": "5.3.0",
|
|
56
|
+
"ajv": "8.17.1",
|
|
57
|
+
"esbuild": "0.28.2"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// The person's own words, kept (harness upgrade U7, HU-F-16). DSH's
|
|
2
|
+
// compaction replaces older history with a model-written checkpoint; the
|
|
3
|
+
// person's request then survives only as well as that summary keeps it
|
|
4
|
+
// (HU-M-06: a summary that drops a requirement loses it). The system prompt
|
|
5
|
+
// is never compacted (dsh-compaction-basic: the range starts after surface
|
|
6
|
+
// node 0), so this keeps every message the person sent in this session,
|
|
7
|
+
// word for word, in a late section: after DSH's own sections, so their
|
|
8
|
+
// cached prefix stays the same. Only `source.kind === "user"` messages: no
|
|
9
|
+
// tool output, reminder or runtime context gets in. Per agent, so a step's
|
|
10
|
+
// builder keeps its own step. Off unless kriya was started with --anchor.
|
|
11
|
+
|
|
12
|
+
export const name = "kriya-anchor"
|
|
13
|
+
export const inject = ["systemPrompt"]
|
|
14
|
+
|
|
15
|
+
// The most kept; the first message always stays, the oldest after it go first
|
|
16
|
+
export const MAX_CHARS = 8000
|
|
17
|
+
|
|
18
|
+
const textOf = (message) =>
|
|
19
|
+
(Array.isArray(message.content) ? message.content : [])
|
|
20
|
+
.filter((part) => part?.type === "text" && typeof part.text === "string")
|
|
21
|
+
.map((part) => part.text)
|
|
22
|
+
.join("\n")
|
|
23
|
+
.trim()
|
|
24
|
+
|
|
25
|
+
/** The section's text for one agent's kept messages; empty when none. */
|
|
26
|
+
export function anchorText(kept) {
|
|
27
|
+
if (!kept.length) return ""
|
|
28
|
+
const [first, ...rest] = kept
|
|
29
|
+
const later = [...rest]
|
|
30
|
+
const size = () => [first, ...later].reduce((n, t) => n + t.length, 0)
|
|
31
|
+
while (later.length && size() > MAX_CHARS) later.shift()
|
|
32
|
+
const lines = [first.slice(0, MAX_CHARS), ...later].map((t, i) => `${i + 1}. ${t}`)
|
|
33
|
+
return (
|
|
34
|
+
"The person's own messages in this session, word for word (later ones refine earlier ones). " +
|
|
35
|
+
"They outrank any summary of the conversation: if a summary leaves out a requirement here, the requirement still holds.\n\n" +
|
|
36
|
+
lines.join("\n\n")
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function apply(ctx) {
|
|
41
|
+
/** @type {WeakMap<object, string[]>} */
|
|
42
|
+
const kept = new WeakMap()
|
|
43
|
+
ctx.on("agent/inbox/inserted", ({ agent, message }) => {
|
|
44
|
+
if (message?.source?.kind !== "user") return
|
|
45
|
+
const text = textOf(message)
|
|
46
|
+
if (!text) return
|
|
47
|
+
kept.set(agent, [...(kept.get(agent) ?? []), text])
|
|
48
|
+
})
|
|
49
|
+
ctx.systemPrompt.section({
|
|
50
|
+
name: "kriya:anchor",
|
|
51
|
+
// After DSH's environment suffix (10200), so the shared prefix is unchanged
|
|
52
|
+
order: 10300,
|
|
53
|
+
interpolate: false,
|
|
54
|
+
text: ({ scope }) => anchorText((scope && kept.get(scope)) ?? []),
|
|
55
|
+
})
|
|
56
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kriya-ai/harness-anchor",
|
|
3
|
+
"description": "Keeps the person's own messages word for word in the system prompt, which compaction never condenses",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./index.js",
|
|
10
|
+
"./package.json": "./package.json"
|
|
11
|
+
},
|
|
12
|
+
"license": "UNLICENSED"
|
|
13
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { call, deviceFromEnv } from "../../src/api.js"
|
|
2
|
+
|
|
3
|
+
// Kriya approvals plugin (H5, HD-08): when DeepSeek Harness asks before a
|
|
4
|
+
// tool runs, the person can answer here (DSH's own prompt) or in Kriya on
|
|
5
|
+
// their phone; the first answer wins and the other side is withdrawn.
|
|
6
|
+
//
|
|
7
|
+
// DSH's approval request names the tool and the call id but not the
|
|
8
|
+
// arguments (dsh-user-approval's README), so a passive `tools/pre-execute`
|
|
9
|
+
// listener remembers each call's arguments by call id. The answerer is
|
|
10
|
+
// prepended to the `approval/request` waterfall: it posts the request to
|
|
11
|
+
// Kriya, then sends a copy of it down the rest of the chain with its own
|
|
12
|
+
// abort signal, so whichever side loses can be withdrawn. Nothing here
|
|
13
|
+
// approves on its own: no answer from either side is `unavailable`, which
|
|
14
|
+
// DSH treats as a refusal (fail closed). Arguments are never logged.
|
|
15
|
+
|
|
16
|
+
export const name = "kriya-approvals"
|
|
17
|
+
|
|
18
|
+
const PHONE_LINE = "Waiting for your answer here or in Kriya on your phone."
|
|
19
|
+
// The contract's limits (ApprovalCreateRequest)
|
|
20
|
+
const MAX_INPUT = 8 * 1024
|
|
21
|
+
const MAX_SUMMARY = 300
|
|
22
|
+
// Calls whose arguments are kept until their approval asks
|
|
23
|
+
const REMEMBERED = 200
|
|
24
|
+
const POLL_SECONDS = 25
|
|
25
|
+
const MAX_FAILURES = 5
|
|
26
|
+
|
|
27
|
+
// Redacted before anything leaves the machine; Kriya redacts again
|
|
28
|
+
const SECRET_KEY =
|
|
29
|
+
/pass(word|wd|phrase)|secret|token|api[-_]?key|^auth$|authorization|cookie|credential|private[-_]?key|^otp$|cvv|card[-_]?number/i
|
|
30
|
+
|
|
31
|
+
export function hideSecrets(value) {
|
|
32
|
+
if (Array.isArray(value)) return value.map(hideSecrets)
|
|
33
|
+
if (!value || typeof value !== "object") return value
|
|
34
|
+
return Object.fromEntries(
|
|
35
|
+
Object.entries(value).map(([key, inner]) => [
|
|
36
|
+
key,
|
|
37
|
+
inner && typeof inner === "object" ? hideSecrets(inner) : SECRET_KEY.test(key) ? "[redacted]" : inner,
|
|
38
|
+
])
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The call's arguments as the contract's `input`: an object of at most 8 KB as JSON */
|
|
43
|
+
export function inputFor(args) {
|
|
44
|
+
if (args === undefined) return { arguments: "not shared by this tool" }
|
|
45
|
+
const plain = args && typeof args === "object" && !Array.isArray(args) ? args : { arguments: args }
|
|
46
|
+
const hidden = hideSecrets(plain)
|
|
47
|
+
const text = JSON.stringify(hidden)
|
|
48
|
+
if (text.length <= MAX_INPUT) return hidden
|
|
49
|
+
let keep = MAX_INPUT - 64
|
|
50
|
+
while (JSON.stringify({ truncated: text.slice(0, keep) }).length > MAX_INPUT) keep -= 256
|
|
51
|
+
return { truncated: text.slice(0, keep) }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const sleep = (ms, signal) =>
|
|
55
|
+
new Promise((done) => {
|
|
56
|
+
const timer = setTimeout(done, ms)
|
|
57
|
+
signal.addEventListener("abort", () => (clearTimeout(timer), done()), { once: true })
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
// The phone's answer: allowed-once, rejected, or null for none (expired,
|
|
61
|
+
// canceled, signed out, Kriya unreachable or this side withdrawn)
|
|
62
|
+
async function phoneAnswer(device, id, signal) {
|
|
63
|
+
let failures = 0
|
|
64
|
+
while (!signal.aborted) {
|
|
65
|
+
try {
|
|
66
|
+
const { status } = await call(device.url, "GET", `/approvals/${id}?wait=${POLL_SECONDS}`, {
|
|
67
|
+
token: device.token,
|
|
68
|
+
signal: AbortSignal.any([signal, AbortSignal.timeout((POLL_SECONDS + 15) * 1000)]),
|
|
69
|
+
})
|
|
70
|
+
failures = 0
|
|
71
|
+
if (status === "approved") return "allowed-once"
|
|
72
|
+
if (status === "declined") return "rejected"
|
|
73
|
+
if (status !== "pending") return null
|
|
74
|
+
} catch (error) {
|
|
75
|
+
if (signal.aborted) return null
|
|
76
|
+
// Signed out, gone or refused: the phone can't answer this one
|
|
77
|
+
if (error.status >= 400 && error.status < 500 && error.status !== 429) return null
|
|
78
|
+
if (++failures >= MAX_FAILURES) return null
|
|
79
|
+
await sleep(Math.min(1000 * 2 ** failures, 15_000), signal)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return null
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function apply(ctx) {
|
|
86
|
+
const remembered = new Map()
|
|
87
|
+
ctx.on("tools/pre-execute", (exec, next) => {
|
|
88
|
+
if (exec.callId !== undefined) {
|
|
89
|
+
remembered.delete(exec.callId)
|
|
90
|
+
remembered.set(exec.callId, exec.arguments)
|
|
91
|
+
if (remembered.size > REMEMBERED) remembered.delete(remembered.keys().next().value)
|
|
92
|
+
}
|
|
93
|
+
return next()
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
const relayed = new WeakSet()
|
|
97
|
+
const warn = (text) => ctx.logger?.warn?.(`kriya approvals: ${text}`)
|
|
98
|
+
|
|
99
|
+
async function answer(carrier, req, device) {
|
|
100
|
+
const stop = new AbortController()
|
|
101
|
+
const signal = req.signal ? AbortSignal.any([req.signal, stop.signal]) : stop.signal
|
|
102
|
+
const cwd = (() => {
|
|
103
|
+
try {
|
|
104
|
+
return ctx.get("workingDirectory")?.get(req.agent.session)
|
|
105
|
+
} catch {
|
|
106
|
+
return undefined
|
|
107
|
+
}
|
|
108
|
+
})()
|
|
109
|
+
let asked
|
|
110
|
+
try {
|
|
111
|
+
asked = await call(device.url, "POST", "/approvals", {
|
|
112
|
+
token: device.token,
|
|
113
|
+
body: {
|
|
114
|
+
sessionRef: String(req.agent?.sessionId ?? "").slice(0, 100),
|
|
115
|
+
tool: req.toolName.slice(0, 60),
|
|
116
|
+
summary: (req.reason || req.displayReason?.en || `Run ${req.toolName}`).slice(0, MAX_SUMMARY),
|
|
117
|
+
input: inputFor(req.callId === undefined ? undefined : remembered.get(req.callId)),
|
|
118
|
+
...(typeof cwd === "string" && cwd && { cwd: cwd.length > 300 ? `…${cwd.slice(-299)}` : cwd }),
|
|
119
|
+
},
|
|
120
|
+
signal: AbortSignal.any([signal, AbortSignal.timeout(10_000)]),
|
|
121
|
+
})
|
|
122
|
+
} catch (error) {
|
|
123
|
+
// Kriya is unreachable or refused: only the local prompt can answer
|
|
124
|
+
warn(`couldn't ask Kriya (${error.code ?? "error"}); answer here`)
|
|
125
|
+
return null
|
|
126
|
+
}
|
|
127
|
+
if (req.callId !== undefined) remembered.delete(req.callId)
|
|
128
|
+
|
|
129
|
+
const local = {
|
|
130
|
+
...req,
|
|
131
|
+
signal,
|
|
132
|
+
displayReason: {
|
|
133
|
+
...req.displayReason,
|
|
134
|
+
en: [req.displayReason?.en ?? req.reason, PHONE_LINE].filter(Boolean).join("\n\n"),
|
|
135
|
+
},
|
|
136
|
+
}
|
|
137
|
+
relayed.add(local)
|
|
138
|
+
const here = Promise.resolve()
|
|
139
|
+
.then(() => ctx.waterfall(carrier, "approval/request", local, () => Promise.resolve("unavailable")))
|
|
140
|
+
.catch(() => "unavailable")
|
|
141
|
+
const phone = phoneAnswer(device, asked.id, signal)
|
|
142
|
+
let phoneDecided = false
|
|
143
|
+
try {
|
|
144
|
+
// The first decisive answer wins; "unavailable" here and none from the
|
|
145
|
+
// phone mean the other side may still answer
|
|
146
|
+
return await new Promise((resolve) => {
|
|
147
|
+
let pending = 2
|
|
148
|
+
const none = () => --pending === 0 && resolve("unavailable")
|
|
149
|
+
here.then((outcome) => {
|
|
150
|
+
if (outcome !== "unavailable") return resolve(outcome)
|
|
151
|
+
if (!signal.aborted)
|
|
152
|
+
process.stderr.write(`kriya: ${req.toolName} needs your OK. Waiting for your answer in Kriya on your phone.\n`)
|
|
153
|
+
none()
|
|
154
|
+
})
|
|
155
|
+
phone.then((outcome) => {
|
|
156
|
+
if (outcome === null) return none()
|
|
157
|
+
phoneDecided = true
|
|
158
|
+
resolve(outcome)
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
} finally {
|
|
162
|
+
// Withdraws whichever side lost; a request the phone didn't decide is canceled on Kriya
|
|
163
|
+
stop.abort()
|
|
164
|
+
if (!phoneDecided)
|
|
165
|
+
call(device.url, "DELETE", `/approvals/${asked.id}`, {
|
|
166
|
+
token: device.token,
|
|
167
|
+
signal: AbortSignal.timeout(5_000),
|
|
168
|
+
}).catch((error) => warn(`couldn't cancel on Kriya (${error.code ?? "error"})`))
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
ctx.on(
|
|
173
|
+
"approval/request",
|
|
174
|
+
function (req, next) {
|
|
175
|
+
// Our own copy, sent down the chain: the rest of the answerers decide it
|
|
176
|
+
if (relayed.has(req)) return next()
|
|
177
|
+
const device = deviceFromEnv()
|
|
178
|
+
if (!device) return next()
|
|
179
|
+
return answer(this, req, device).then((outcome) => outcome ?? next())
|
|
180
|
+
},
|
|
181
|
+
{ prepend: true }
|
|
182
|
+
)
|
|
183
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kriya-ai/harness-approvals",
|
|
3
|
+
"description": "Approvals from the phone for the Kriya Harness: DeepSeek Harness's approval requests answered here or in Kriya, first answer wins",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./index.js",
|
|
10
|
+
"./package.json": "./package.json"
|
|
11
|
+
},
|
|
12
|
+
"license": "UNLICENSED"
|
|
13
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Kriya Harness: design
|
|
2
|
+
|
|
3
|
+
The Web UI is DeepSeek Harness's, dressed as Kriya through the seams it
|
|
4
|
+
offers other identities: theme token overrides (`ctx.theme.overrideTokens`),
|
|
5
|
+
the brand slots, and plugin-owned styles. Layout and behaviour stay DSH's;
|
|
6
|
+
nothing in DSH is edited.
|
|
7
|
+
|
|
8
|
+
## Subject
|
|
9
|
+
|
|
10
|
+
Kriya Harness is your Kriya agent working in a folder on your own machine.
|
|
11
|
+
The people using it build things: they give the agent a job, watch it read,
|
|
12
|
+
edit and run, and approve what it asks. Long sessions, mostly reading.
|
|
13
|
+
"Kriya" means action, and Kriya's mark is stitched: on Tavi, the mascot, the
|
|
14
|
+
K is embroidered thread with a terracotta leaf where its strokes meet.
|
|
15
|
+
|
|
16
|
+
## The one memorable thing
|
|
17
|
+
|
|
18
|
+
The start screen stitches the K. Before the first message, the mark is drawn
|
|
19
|
+
as a running stitch in saffron thread, then fills in, then the question
|
|
20
|
+
appears under it, all in a soft pool of light (`--kh-halo`). It plays once
|
|
21
|
+
per page load and never moves again (reduced motion: drawn complete).
|
|
22
|
+
Everything else stays quiet so this lands.
|
|
23
|
+
|
|
24
|
+
## Colour
|
|
25
|
+
|
|
26
|
+
Kriya's own palette (the Kriya app's `app/globals.css`), mapped onto DSH's
|
|
27
|
+
tokens. Teal is action (buttons, links, focus); saffron is the thread and
|
|
28
|
+
the agent at work; the leaf appears only in the mark.
|
|
29
|
+
|
|
30
|
+
| Name | Light | Dark | Used for |
|
|
31
|
+
| --- | --- | --- | --- |
|
|
32
|
+
| Paper | `#F3EEE6` | `#0A1213` | Main background |
|
|
33
|
+
| Leaf-sheet | `#FBF8F3` | `#122021` | Raised surfaces, composer, menus |
|
|
34
|
+
| Loom | `#EAE3D7` | `#071011` | Sidebar column |
|
|
35
|
+
| Ink | `#13292B` | `#F2EADF` | Text |
|
|
36
|
+
| Teal | `#1F6362` | `#6CC0B8` | Action, links, focus ring, selection |
|
|
37
|
+
| Saffron | `#B4622F` | `#E7A46D` | Thread, agent activity, warnings |
|
|
38
|
+
|
|
39
|
+
Secondary text, borders and hover fills are Ink at fixed opacities, so they
|
|
40
|
+
sit on either paper without new hues. Success and error keep their meaning
|
|
41
|
+
(`#2C8A5F`/`#6FD3A0`, `#C2413A`/`#F07A6E`, Kriya's own).
|
|
42
|
+
|
|
43
|
+
## Material: glass over cloth
|
|
44
|
+
|
|
45
|
+
The interface is panes of tinted glass floating over a lit ground. The
|
|
46
|
+
colours above stay exactly as they are; the material changes what the
|
|
47
|
+
surfaces are made of, not their hue.
|
|
48
|
+
|
|
49
|
+
- **The ground.** Paper with a fine grain, lit by two faint lights: teal
|
|
50
|
+
from the top (`--kh-ground-a`, 12 % light / 10 % dark) and saffron warmth
|
|
51
|
+
from the bottom right (`--kh-ground-b`, 9 % / 6 %). It is the only
|
|
52
|
+
gradient, and it is light, never decoration on text or controls.
|
|
53
|
+
- **Panes.** The sidebar floats inset from the window edges as a thin
|
|
54
|
+
pane (`--kh-glass`); the composer, the approval card and Settings are
|
|
55
|
+
thick panes (`--kh-glass-thick`), because text is typed or read there.
|
|
56
|
+
Each pane blurs what's behind it (`--kh-blur`), catches light on its top
|
|
57
|
+
edge with a hairline around it (`--kh-rim`) and floats on a soft
|
|
58
|
+
shadow (`--kh-lift`, `--kh-lift-high` for dialogs). DSH's menus and every
|
|
59
|
+
other DSH elevation share the same lift.
|
|
60
|
+
- **Wells and chips.** Things below a pane (the Settings nav, the Chat and
|
|
61
|
+
Trajectory control, a disabled send) sit in a well (`--kh-well`);
|
|
62
|
+
selected things sit on it as a raised chip with the same rim
|
|
63
|
+
(`--kh-chip`): the active session, the active Settings section, the
|
|
64
|
+
active tab, New Session.
|
|
65
|
+
- **Focus and waiting.** The composer lights teal while it has focus (an
|
|
66
|
+
edge and a 4 px halo); an approval waits edged in saffron the same way.
|
|
67
|
+
- **The person's message** is a teal-dyed pane with its bottom-right corner
|
|
68
|
+
turned toward them.
|
|
69
|
+
- **The agent at work** is a running stitch moving through saffron thread,
|
|
70
|
+
in place of DeepSeek's whale.
|
|
71
|
+
|
|
72
|
+
How it is built: every pane draws its glass on a `::before` behind its
|
|
73
|
+
content, never on the pane itself, because a `backdrop-filter` on the pane
|
|
74
|
+
would trap DSH's `position: fixed` children. Rules sit under
|
|
75
|
+
`html[data-kh-glass]`, set while the brand's styles are installed, so they
|
|
76
|
+
outrank DSH's own whatever order stylesheets load in. The DSH classes they
|
|
77
|
+
name are hashed per DSH build; `tests/brand.test.js` fails when the pinned
|
|
78
|
+
DSH loses any of them.
|
|
79
|
+
|
|
80
|
+
Fallbacks: with reduced transparency, or where `backdrop-filter` isn't
|
|
81
|
+
drawn, panes turn solid (Sheet, Leaf-sheet). With more contrast, every pane
|
|
82
|
+
gets a solid 1 px edge.
|
|
83
|
+
|
|
84
|
+
## Type
|
|
85
|
+
|
|
86
|
+
- **Geist** (variable): interface and conversation text. A plain, technical
|
|
87
|
+
grotesk for a tool read for hours; different from both DSH's system stack
|
|
88
|
+
and the Kriya app's Inter, so the harness is recognisably its own room in
|
|
89
|
+
the same house.
|
|
90
|
+
- **Fraunces** (variable, soft optical sizes): the start-screen question
|
|
91
|
+
and the sidebar name. Kriya's display face. Replies keep Geist headings:
|
|
92
|
+
DSH sets them through shorthand font tokens with computed sizes, which a
|
|
93
|
+
family override can't touch safely.
|
|
94
|
+
- **JetBrains Mono**: code, diffs, the terminal. Kriya's code face.
|
|
95
|
+
|
|
96
|
+
Fonts are embedded in the plugin (the UI works offline on 127.0.0.1); a font
|
|
97
|
+
chosen in Settings still takes precedence over these.
|
|
98
|
+
|
|
99
|
+
## Rules
|
|
100
|
+
|
|
101
|
+
- No all-caps labels, no monospace for labels. The only gradients are the
|
|
102
|
+
ground's light and the halo behind the start screen's K.
|
|
103
|
+
- One signature motion (the stitch). Beyond it, only feedback: hover and
|
|
104
|
+
focus ease in over 160–240 ms, a pressed send or New Session gives a
|
|
105
|
+
little; none of it plays with reduced motion.
|
|
106
|
+
- Contrast: body text at least 7:1 on Paper in both schemes; secondary text
|
|
107
|
+
at least 4.5:1, also on every glass pane laid over every part of the
|
|
108
|
+
ground (tested).
|
|
109
|
+
- Layout and behaviour stay DSH's: the material never moves, hides or
|
|
110
|
+
resizes DSH's controls (its only removal is the scroll fade painted in
|
|
111
|
+
the old solid sidebar colour).
|
|
112
|
+
- Copy is plain and says what is true: what runs where, what costs what.
|