shadok-ai 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ground.d.ts +91 -0
- package/dist/ground.js +120 -0
- package/dist/ground.js.map +1 -0
- package/dist/profiles.js +6 -1
- package/dist/profiles.js.map +1 -1
- package/package.json +1 -1
- package/public/index.html +20 -3
package/dist/ground.d.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What kind of project a directory holds, read deterministically.
|
|
3
|
+
*
|
|
4
|
+
* This is the cron guard's move applied to onboarding: the cheap check runs
|
|
5
|
+
* first, and the model is only worth waking once there is something to say.
|
|
6
|
+
* Recognising a `Gemfile` is not reasoning — it is a table lookup, and paying a
|
|
7
|
+
* model call for it would be slower, costlier and less reliable than reading
|
|
8
|
+
* the directory.
|
|
9
|
+
*
|
|
10
|
+
* Everything here is fs-only: NO model call, NO network, no process spawn (not
|
|
11
|
+
* even `git`), so it cannot hang, cannot cost quota and cannot fail in a way
|
|
12
|
+
* the caller has to handle. The core is pure over an injected listing, the way
|
|
13
|
+
* `spawnHelperPaths` and `classifyBin` are, so the fixtures below are directory
|
|
14
|
+
* SHAPES rather than directories on disk.
|
|
15
|
+
*
|
|
16
|
+
* The load-bearing case is the one that finds nothing. A directory shadok does
|
|
17
|
+
* not recognise is a legitimate finding about the project, not a failed lookup:
|
|
18
|
+
* the honest "I recognise nothing here" is what stops the layer above inventing
|
|
19
|
+
* a stack, which is the one failure a greeting cannot recover from.
|
|
20
|
+
*/
|
|
21
|
+
/** One entry of a directory listing — all the core ever needs to know. */
|
|
22
|
+
export interface GroundEntry {
|
|
23
|
+
name: string;
|
|
24
|
+
/** Whether the entry is a directory. Note `.git` is a FILE in a worktree. */
|
|
25
|
+
dir: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Lists a path RELATIVE to the directory under inspection (`""` is its root).
|
|
29
|
+
* Returns `[]` for anything missing — absence is a normal answer here, never an
|
|
30
|
+
* error, so no caller has to wrap this in a try.
|
|
31
|
+
*/
|
|
32
|
+
export type ListDir = (relPath: string) => GroundEntry[];
|
|
33
|
+
export type Vcs = "git" | "mercurial" | "subversion";
|
|
34
|
+
export type StackKind = "node" | "ruby" | "python" | "go" | "rust" | "java" | "php" | "elixir" | "swift" | "xcode" | "dotnet" | "flutter";
|
|
35
|
+
export type CiKind = "github-actions" | "gitlab-ci" | "circleci" | "travis" | "jenkins" | "azure-pipelines";
|
|
36
|
+
/**
|
|
37
|
+
* A recognised stack, plus the file that proved it. The marker is kept because
|
|
38
|
+
* the layer above has to name what it SAW ("a Gemfile", "Shadok.xcodeproj")
|
|
39
|
+
* rather than a category word the user never wrote — a greeting that says
|
|
40
|
+
* "ruby" where the directory says `Gemfile` is already paraphrasing.
|
|
41
|
+
*/
|
|
42
|
+
export interface StackHit {
|
|
43
|
+
kind: StackKind;
|
|
44
|
+
marker: string;
|
|
45
|
+
}
|
|
46
|
+
export interface CiHit {
|
|
47
|
+
kind: CiKind;
|
|
48
|
+
marker: string;
|
|
49
|
+
}
|
|
50
|
+
export interface Ground {
|
|
51
|
+
/** Version control at the root, or null. */
|
|
52
|
+
vcs: Vcs | null;
|
|
53
|
+
/** Stack markers recognised, in table order — never in readdir order. */
|
|
54
|
+
stacks: StackHit[];
|
|
55
|
+
/** CI configuration recognised, in table order. */
|
|
56
|
+
ci: CiHit[];
|
|
57
|
+
/**
|
|
58
|
+
* Convention files the project actually carries (CLAUDE.md, AGENTS.md,
|
|
59
|
+
* CONTRIBUTING.md, a README), named as found. Deliberately NOT counted as
|
|
60
|
+
* recognition below: a README is not a stack, and letting one satisfy the
|
|
61
|
+
* check would make the honest register unreachable for a folder of prose.
|
|
62
|
+
*/
|
|
63
|
+
conventions: string[];
|
|
64
|
+
/** The directory holds no entries at all — or does not exist. */
|
|
65
|
+
empty: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Nothing here was recognised: no version control, no stack marker, no CI.
|
|
68
|
+
* A finding, not a failure.
|
|
69
|
+
*
|
|
70
|
+
* Note this is not the same question as `stacks.length === 0`: a git repo of
|
|
71
|
+
* pure Markdown is recognised (it has version control) while its stack stays
|
|
72
|
+
* honestly unknown. Callers picking how confidently to speak should read the
|
|
73
|
+
* field that matches the claim they are about to make.
|
|
74
|
+
*/
|
|
75
|
+
unrecognised: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Inspect a directory through an injected listing. Pure: same listing, same
|
|
79
|
+
* report, no clock, no filesystem, no ordering dependency on readdir.
|
|
80
|
+
*/
|
|
81
|
+
export declare function readGround(list: ListDir): Ground;
|
|
82
|
+
/**
|
|
83
|
+
* `readGround` against the real filesystem. Thin on purpose — everything worth
|
|
84
|
+
* testing lives in the pure core, and this half is the part that cannot be.
|
|
85
|
+
*
|
|
86
|
+
* A directory that does not exist, or that we may not read, lists as empty
|
|
87
|
+
* rather than throwing: "I cannot see anything here" and "there is nothing
|
|
88
|
+
* here" lead to the same honest register, and neither is worth a crash on a
|
|
89
|
+
* path that only ever produces a greeting.
|
|
90
|
+
*/
|
|
91
|
+
export declare function readGroundAt(dir: string): Ground;
|
package/dist/ground.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* Stack markers, most specific first. `exact` names match verbatim, because
|
|
5
|
+
* these files are spelled one way by convention (`Gemfile`, `Cargo.toml`);
|
|
6
|
+
* `suffix` matches are case-insensitive and record the real filename, since
|
|
7
|
+
* that half is a project's own name (`Shadok.xcodeproj`).
|
|
8
|
+
*/
|
|
9
|
+
const STACKS = [
|
|
10
|
+
{ kind: "node", exact: ["package.json"] },
|
|
11
|
+
{ kind: "ruby", exact: ["Gemfile"], suffix: [".gemspec"] },
|
|
12
|
+
{ kind: "python", exact: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"] },
|
|
13
|
+
{ kind: "go", exact: ["go.mod"] },
|
|
14
|
+
{ kind: "rust", exact: ["Cargo.toml"] },
|
|
15
|
+
{ kind: "java", exact: ["pom.xml", "build.gradle", "build.gradle.kts", "settings.gradle"] },
|
|
16
|
+
{ kind: "php", exact: ["composer.json"] },
|
|
17
|
+
{ kind: "elixir", exact: ["mix.exs"] },
|
|
18
|
+
{ kind: "swift", exact: ["Package.swift"] },
|
|
19
|
+
{ kind: "xcode", suffix: [".xcodeproj", ".xcworkspace"] },
|
|
20
|
+
{ kind: "dotnet", suffix: [".csproj", ".fsproj", ".sln"] },
|
|
21
|
+
{ kind: "flutter", exact: ["pubspec.yaml"] },
|
|
22
|
+
];
|
|
23
|
+
/** CI systems configured by a single file at the root. */
|
|
24
|
+
const FLAT_CI = [
|
|
25
|
+
{ kind: "gitlab-ci", exact: [".gitlab-ci.yml"] },
|
|
26
|
+
{ kind: "travis", exact: [".travis.yml"] },
|
|
27
|
+
{ kind: "jenkins", exact: ["Jenkinsfile"] },
|
|
28
|
+
{ kind: "azure-pipelines", exact: ["azure-pipelines.yml", "azure-pipelines.yaml"] },
|
|
29
|
+
];
|
|
30
|
+
const VCS_DIRS = [
|
|
31
|
+
{ name: ".git", vcs: "git" },
|
|
32
|
+
{ name: ".hg", vcs: "mercurial" },
|
|
33
|
+
{ name: ".svn", vcs: "subversion" },
|
|
34
|
+
];
|
|
35
|
+
const CONVENTION_FILES = ["CLAUDE.md", "AGENTS.md", "CONTRIBUTING.md"];
|
|
36
|
+
/**
|
|
37
|
+
* Inspect a directory through an injected listing. Pure: same listing, same
|
|
38
|
+
* report, no clock, no filesystem, no ordering dependency on readdir.
|
|
39
|
+
*/
|
|
40
|
+
export function readGround(list) {
|
|
41
|
+
const root = list("");
|
|
42
|
+
const names = new Set(root.map((e) => e.name));
|
|
43
|
+
// `.git` is a FILE inside a git worktree (it points at the real gitdir), and
|
|
44
|
+
// every shadok agent works in one — testing `isDirectory()` here would
|
|
45
|
+
// misreport exactly the directories this project spends its life in.
|
|
46
|
+
const vcs = VCS_DIRS.find((v) => names.has(v.name))?.vcs ?? null;
|
|
47
|
+
const stacks = [];
|
|
48
|
+
for (const s of STACKS) {
|
|
49
|
+
const marker = s.exact?.find((n) => names.has(n)) ??
|
|
50
|
+
(s.suffix ? findBySuffix(root, s.suffix) : undefined);
|
|
51
|
+
if (marker)
|
|
52
|
+
stacks.push({ kind: s.kind, marker });
|
|
53
|
+
}
|
|
54
|
+
const ci = [];
|
|
55
|
+
// GitHub Actions is the directory's CONTENTS, not the directory: an empty
|
|
56
|
+
// `.github/workflows` (or a `.github` holding only an issue template) is not
|
|
57
|
+
// a configured CI, and reporting one would be the invented answer this
|
|
58
|
+
// module exists to avoid.
|
|
59
|
+
const workflows = list(path.posix.join(".github", "workflows"));
|
|
60
|
+
if (workflows.length > 0) {
|
|
61
|
+
ci.push({ kind: "github-actions", marker: ".github/workflows" });
|
|
62
|
+
}
|
|
63
|
+
if (list(".circleci").some((e) => e.name === "config.yml" || e.name === "config.yaml")) {
|
|
64
|
+
ci.push({ kind: "circleci", marker: ".circleci/config.yml" });
|
|
65
|
+
}
|
|
66
|
+
for (const c of FLAT_CI) {
|
|
67
|
+
const marker = c.exact.find((n) => names.has(n));
|
|
68
|
+
if (marker)
|
|
69
|
+
ci.push({ kind: c.kind, marker });
|
|
70
|
+
}
|
|
71
|
+
const conventions = [];
|
|
72
|
+
for (const f of CONVENTION_FILES) {
|
|
73
|
+
const hit = root.find((e) => !e.dir && e.name.toLowerCase() === f.toLowerCase());
|
|
74
|
+
if (hit)
|
|
75
|
+
conventions.push(hit.name);
|
|
76
|
+
}
|
|
77
|
+
// A README is any of README, README.md, README.rst… — matched by prefix, and
|
|
78
|
+
// reported under the name it actually has.
|
|
79
|
+
const readme = root.find((e) => !e.dir && e.name.toLowerCase().startsWith("readme"));
|
|
80
|
+
if (readme)
|
|
81
|
+
conventions.push(readme.name);
|
|
82
|
+
return {
|
|
83
|
+
vcs,
|
|
84
|
+
stacks,
|
|
85
|
+
ci,
|
|
86
|
+
conventions,
|
|
87
|
+
empty: root.length === 0,
|
|
88
|
+
unrecognised: vcs === null && stacks.length === 0 && ci.length === 0,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function findBySuffix(entries, suffixes) {
|
|
92
|
+
for (const e of entries) {
|
|
93
|
+
const lower = e.name.toLowerCase();
|
|
94
|
+
if (suffixes.some((s) => lower.endsWith(s)))
|
|
95
|
+
return e.name;
|
|
96
|
+
}
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* `readGround` against the real filesystem. Thin on purpose — everything worth
|
|
101
|
+
* testing lives in the pure core, and this half is the part that cannot be.
|
|
102
|
+
*
|
|
103
|
+
* A directory that does not exist, or that we may not read, lists as empty
|
|
104
|
+
* rather than throwing: "I cannot see anything here" and "there is nothing
|
|
105
|
+
* here" lead to the same honest register, and neither is worth a crash on a
|
|
106
|
+
* path that only ever produces a greeting.
|
|
107
|
+
*/
|
|
108
|
+
export function readGroundAt(dir) {
|
|
109
|
+
return readGround((rel) => {
|
|
110
|
+
try {
|
|
111
|
+
return fs
|
|
112
|
+
.readdirSync(rel ? path.join(dir, rel) : dir, { withFileTypes: true })
|
|
113
|
+
.map((d) => ({ name: d.name, dir: d.isDirectory() }));
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=ground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ground.js","sourceRoot":"","sources":["../src/ground.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAyG7B;;;;;GAKG;AACH,MAAM,MAAM,GAA+D;IACzE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,cAAc,CAAC,EAAE;IACzC,EAAE,IAAI,EAAE,MA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AAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;iBACrE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC;QAC1D,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/profiles.js
CHANGED
|
@@ -24,7 +24,12 @@ export const DEFAULT_PROFILES = [
|
|
|
24
24
|
// git writes force them to go through an agent.
|
|
25
25
|
name: "Shadok-Boss",
|
|
26
26
|
systemPrompt: "You are Shadok-Boss, the lead agent of this environment. You run on the `general` channel — the user talks to you first. You have two jobs, in this order.\n\n" +
|
|
27
|
-
|
|
27
|
+
// Deliberately does NOT name shadok-ai's own layout. This prompt ships
|
|
28
|
+
// to every cockpit, and "read docs/ and its specs" is true for exactly
|
|
29
|
+
// one directory in the world — everywhere else it sent the lead hunting
|
|
30
|
+
// for a structure that is not there. The convention files are an
|
|
31
|
+
// enumeration to choose from, never a checklist to satisfy.
|
|
32
|
+
"KNOW. Before you answer, read the ground. Start with whatever convention file this project actually carries — CLAUDE.md, AGENTS.md, CONTRIBUTING.md, the README — then its layout, and its recent history where there is version control. Assume none of them exist: you may be in a Rails app, an Xcode project or a folder of marketing copy just as easily as in a repo that documents itself. Their absence is information about the project, not a failed lookup — infer the conventions from what IS there, and never invent one. When the user asks a question, answer it yourself: conclusion first, compact. Never make someone wait behind a spawned agent when a read would do.\n\n" +
|
|
28
33
|
"DELEGATE. You have READ-ONLY access to the code — git writes are blocked, and that is deliberate. Every piece of actual work (a feature, a fix, a refactor, a research pass) goes to a dedicated agent, never to you. Use the `shadok-ai-agents` skill: `pilotctl.mjs spawn --worktree --profile <role> --cwd <repo>`, then `prompt <id> \"<brief>\"` in the background. Write a brief precise enough to be executed without you: the goal, the constraints, and how you'll know it's done. Then follow up, read `diff <id>`, and report it to the user.\n\n" +
|
|
29
34
|
"Pick the role deliberately: Shadok-dev for code, Shadok-Marketing for paid acquisition and ad copy, Shadok-Content for articles and organic/SEO work, Shadok-Support for user-facing answers. Spawn without --profile only when none of them fits.\n\n" +
|
|
30
35
|
"SHAPE THE ROLES. You may rewrite any profile's system prompt, and mint new ones, with `pilotctl.mjs profile-prompt \"<text>\" --name <role> [--readonly]` — use it to record what a role should have known from the start. You cannot touch a profile's guardrails (deny/allow/secrets/model): those are the human's, and a role you create never carries a vault secret. A prompt change takes effect at that agent's next restart.\n\n" +
|
package/dist/profiles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAwC7B,mFAAmF;AACnF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,oBAAoB;IACpB,kBAAkB;IAClB,iBAAiB;IACjB,mBAAmB;IACnB,oBAAoB;IACpB,mBAAmB;IACnB,sBAAsB;CACvB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAc;IACzC;QACE,wEAAwE;QACxE,0EAA0E;QAC1E,gDAAgD;QAChD,IAAI,EAAE,aAAa;QACnB,YAAY,EACV,gKAAgK;YAChK,
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAwC7B,mFAAmF;AACnF,MAAM,CAAC,MAAM,aAAa,GAAG;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AO,CAAC,GAAG,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC7B,CAAC"}
|
package/package.json
CHANGED
package/public/index.html
CHANGED
|
@@ -2190,7 +2190,20 @@
|
|
|
2190
2190
|
}
|
|
2191
2191
|
}
|
|
2192
2192
|
|
|
2193
|
-
|
|
2193
|
+
/**
|
|
2194
|
+
* `focus` says whether the new tab takes over the view. It defaults to true
|
|
2195
|
+
* because most callers ARE the user asking for a tab — the Start-agent
|
|
2196
|
+
* button, the phone's "new agent" entry, the Tweak CTA — and those must land
|
|
2197
|
+
* on what they just created.
|
|
2198
|
+
*
|
|
2199
|
+
* `syncChannels` is the exception, and the reason this option exists. It
|
|
2200
|
+
* creates a tab for every channel it DISCOVERS on the server, every four
|
|
2201
|
+
* seconds, so an agent spawned by another agent, from Telegram, from a cron
|
|
2202
|
+
* or on another machine used to yank every open browser onto it mid-sentence.
|
|
2203
|
+
* Delegating is this product's central action; it must not cost the user
|
|
2204
|
+
* their place in the conversation they are having.
|
|
2205
|
+
*/
|
|
2206
|
+
function createTab(groupId, { focus = true } = {}) {
|
|
2194
2207
|
seq++;
|
|
2195
2208
|
const el = document.createElement("div");
|
|
2196
2209
|
el.className = "transcript";
|
|
@@ -2335,7 +2348,7 @@
|
|
|
2335
2348
|
});
|
|
2336
2349
|
btn.addEventListener("dragend", () => endDrag());
|
|
2337
2350
|
tabs.push(tab);
|
|
2338
|
-
activate(tab);
|
|
2351
|
+
if (focus) activate(tab);
|
|
2339
2352
|
return tab;
|
|
2340
2353
|
}
|
|
2341
2354
|
|
|
@@ -3133,7 +3146,11 @@
|
|
|
3133
3146
|
saveName(t, c.name);
|
|
3134
3147
|
}
|
|
3135
3148
|
} else if (!dismissedChannels.has(c.sessionId)) {
|
|
3136
|
-
|
|
3149
|
+
// Discovered, not asked for: never steal the view. The one exception is
|
|
3150
|
+
// an empty cockpit — with `active === null` the user is looking at
|
|
3151
|
+
// #emptyState (invariant 18), so this displaces nobody, and showing the
|
|
3152
|
+
// channel beats leaving them in front of nothing.
|
|
3153
|
+
const nt = createTab(c.group, { focus: !active });
|
|
3137
3154
|
nt.sessionId = c.sessionId;
|
|
3138
3155
|
nt.draft = savedDrafts[c.sessionId] || "";
|
|
3139
3156
|
if (c.branch) nt.branch = c.branch;
|