@agentshouse/kit 0.1.0-alpha.9 → 0.2.1-alpha.1

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.
Files changed (93) hide show
  1. package/README.md +14 -1740
  2. package/dist/acp.js +120 -0
  3. package/dist/agents.js +90 -0
  4. package/dist/api.js +45 -0
  5. package/dist/blocks.js +51 -0
  6. package/dist/bridge.js +124 -0
  7. package/dist/clis.js +110 -0
  8. package/dist/conversations.js +538 -0
  9. package/dist/files.js +21 -0
  10. package/dist/home.js +24 -0
  11. package/dist/house-main.js +92 -0
  12. package/dist/instructions.js +28 -0
  13. package/dist/kit-main.js +16 -0
  14. package/dist/login.js +112 -0
  15. package/dist/resident.js +66 -0
  16. package/dist/secret-input.js +16 -0
  17. package/dist/sign-in.js +83 -0
  18. package/dist/stream.js +47 -0
  19. package/package.json +34 -10
  20. package/bin/connect-linux.sh +0 -134
  21. package/bin/kit.js +0 -1023
  22. package/bootstrap.json +0 -17
  23. package/src/acp.js +0 -99
  24. package/src/adapter-mcp.js +0 -44
  25. package/src/adapter.js +0 -252
  26. package/src/agent-logins.js +0 -65
  27. package/src/agents.js +0 -504
  28. package/src/apply.js +0 -29
  29. package/src/attach.js +0 -52
  30. package/src/binding.js +0 -90
  31. package/src/blocks.js +0 -156
  32. package/src/bridge.js +0 -449
  33. package/src/bytes.js +0 -89
  34. package/src/channel.js +0 -37
  35. package/src/command.js +0 -109
  36. package/src/configuration.js +0 -465
  37. package/src/connector-login.js +0 -91
  38. package/src/connector.js +0 -107
  39. package/src/continuation.js +0 -61
  40. package/src/contract.js +0 -363
  41. package/src/conversation-originals.js +0 -143
  42. package/src/custom/authorization.js +0 -63
  43. package/src/declaration.js +0 -35
  44. package/src/delivery.js +0 -191
  45. package/src/directory.js +0 -102
  46. package/src/draft.js +0 -89
  47. package/src/google/calendar.js +0 -177
  48. package/src/google/declared.js +0 -146
  49. package/src/google/drive.js +0 -435
  50. package/src/google/gateway.js +0 -166
  51. package/src/google/gmail.js +0 -249
  52. package/src/google/id.js +0 -1
  53. package/src/google/oauth.js +0 -273
  54. package/src/google/source.js +0 -25
  55. package/src/hook.js +0 -376
  56. package/src/host.js +0 -121
  57. package/src/house-main.js +0 -79
  58. package/src/house.js +0 -1090
  59. package/src/inbound.js +0 -175
  60. package/src/instance/google.js +0 -1
  61. package/src/kit-work-stream.js +0 -84
  62. package/src/launcher-main.js +0 -19
  63. package/src/launcher.js +0 -276
  64. package/src/local-files.js +0 -113
  65. package/src/login.js +0 -274
  66. package/src/mcp.js +0 -71
  67. package/src/migrator.js +0 -248
  68. package/src/mount.js +0 -582
  69. package/src/operation.js +0 -20
  70. package/src/original.js +0 -631
  71. package/src/peer.js +0 -124
  72. package/src/plan.js +0 -57
  73. package/src/question.js +0 -316
  74. package/src/refusal.js +0 -79
  75. package/src/repository.js +0 -521
  76. package/src/session-bin/house +0 -2
  77. package/src/settlement.js +0 -57
  78. package/src/setup.js +0 -190
  79. package/src/source-originals.js +0 -116
  80. package/src/source.js +0 -286
  81. package/src/starter-set/grilling/LICENSE +0 -21
  82. package/src/starter-set/grilling/SKILL.md +0 -30
  83. package/src/starter-set/grilling/agents/openai.yaml +0 -3
  84. package/src/starter-set.js +0 -17
  85. package/src/state.js +0 -157
  86. package/src/sync-library.js +0 -293
  87. package/src/sync-state.js +0 -120
  88. package/src/sync.js +0 -482
  89. package/src/telegram.js +0 -1045
  90. package/src/terminal.js +0 -57
  91. package/src/tmux.js +0 -119
  92. package/src/worker.js +0 -925
  93. package/src/workspace.js +0 -500
package/src/terminal.js DELETED
@@ -1,57 +0,0 @@
1
- import {
2
- EXECUTION_FAILURE_CAUSE_MAX,
3
- EXECUTION_OUTCOMES,
4
- PROVIDER_CAPACITY_EXHAUSTED,
5
- PROVIDER_CONTINUATION_UNAVAILABLE,
6
- PROVIDER_REFUSED,
7
- } from "./contract.js";
8
-
9
- export function reportedCause(failure) {
10
- const named =
11
- failure.detail === null || failure.detail === undefined
12
- ? failure.code
13
- : `${failure.code}: ${failure.detail}`;
14
- return named.slice(0, EXECUTION_FAILURE_CAUSE_MAX);
15
- }
16
-
17
- export function failedReport(failure) {
18
- return { outcome: "failed", cause: reportedCause(failure) };
19
- }
20
-
21
- export function terminalReport(observed) {
22
- if (observed.capacityExhausted) {
23
- return { outcome: "failed", cause: PROVIDER_CAPACITY_EXHAUSTED };
24
- }
25
- if (observed.providerRefused) {
26
- return { outcome: "failed", cause: PROVIDER_REFUSED };
27
- }
28
- if (observed.failure !== null && observed.failure !== undefined) {
29
- return failedReport(observed.failure);
30
- }
31
- if (observed.turnCompleted && !observed.conversation) return { outcome: "completed", cause: null };
32
- if (observed.continuable) return null;
33
- return { outcome: "failed", cause: PROVIDER_CONTINUATION_UNAVAILABLE };
34
- }
35
-
36
- export function reportedNote(reported) {
37
- return { operation: reported.operation, outcome: reported.outcome, cause: reported.cause };
38
- }
39
-
40
- export function retainedReport(stored) {
41
- if (stored === null || stored === undefined) return null;
42
- if (typeof stored !== "object" || Array.isArray(stored)) return undefined;
43
- if (typeof stored.operation !== "string" || stored.operation.length === 0) return undefined;
44
- if (!EXECUTION_OUTCOMES.includes(stored.outcome)) return undefined;
45
- if (stored.outcome === "completed") {
46
- if (stored.cause !== null) return undefined;
47
- return { operation: stored.operation, outcome: stored.outcome, cause: null };
48
- }
49
- if (
50
- typeof stored.cause !== "string" ||
51
- stored.cause.length === 0 ||
52
- stored.cause.length > EXECUTION_FAILURE_CAUSE_MAX
53
- ) {
54
- return undefined;
55
- }
56
- return { operation: stored.operation, outcome: stored.outcome, cause: stored.cause };
57
- }
package/src/tmux.js DELETED
@@ -1,119 +0,0 @@
1
- import { createHash, randomBytes } from "node:crypto";
2
- import { mkdir, writeFile } from "node:fs/promises";
3
- import { join } from "node:path";
4
- import { runCommand, withoutHouseCredentials } from "./command.js";
5
- import { TMUX_COMMAND_TIMEOUT_MS, TMUX_SUPPORTED_MINIMUM } from "./contract.js";
6
- import { KitRefusal } from "./refusal.js";
7
-
8
- const VERSION_LINE = /^tmux (?:next-)?(\d+)\.(\d+)/;
9
- const SESSION_NAME = /^[a-f0-9]{16}$/;
10
-
11
- const PREREQUISITE =
12
- `the Environment owner must install tmux ${TMUX_SUPPORTED_MINIMUM} or newer and make it reachable on PATH; ` +
13
- "House Kit never installs, upgrades, or replaces tmux";
14
-
15
- function parsedVersion(line) {
16
- const found = VERSION_LINE.exec(line.trim());
17
- return found === null ? null : [Number(found[1]), Number(found[2])];
18
- }
19
-
20
- const REQUIRED_VERSION = parsedVersion(`tmux ${TMUX_SUPPORTED_MINIMUM}`);
21
-
22
- const NAMESPACE_CONFIGURATION = "set-option -g -w remain-on-exit off\n";
23
-
24
- export function tmuxNamespace(directory) {
25
- return `house-kit-${createHash("sha256").update(directory).digest("hex").slice(0, 16)}`;
26
- }
27
-
28
- export function workerRuntime(directory, tmux) {
29
- return {
30
- tmux,
31
- namespace: tmuxNamespace(directory),
32
- configuration: join(directory, "tmux", "namespace.conf"),
33
- };
34
- }
35
-
36
- export function workerSessionName() {
37
- return randomBytes(8).toString("hex");
38
- }
39
-
40
- function namespaced(runtime, args) {
41
- return runCommand({
42
- command: [runtime.tmux, "-L", runtime.namespace, "-f", runtime.configuration, ...args],
43
- environment: {},
44
- stdin: "",
45
- timeoutMs: TMUX_COMMAND_TIMEOUT_MS,
46
- });
47
- }
48
-
49
- export async function readyTmux(runtime) {
50
- let reported;
51
- try {
52
- reported = await runCommand({
53
- command: [runtime.tmux, "-V"],
54
- environment: {},
55
- stdin: "",
56
- timeoutMs: TMUX_COMMAND_TIMEOUT_MS,
57
- });
58
- } catch (refusal) {
59
- if (refusal instanceof KitRefusal && refusal.code === "kit_command_unavailable") {
60
- throw new KitRefusal("kit_tmux_unavailable", PREREQUISITE);
61
- }
62
- throw refusal;
63
- }
64
- if (reported.status !== 0) throw new KitRefusal("kit_tmux_unavailable", PREREQUISITE);
65
- const found = parsedVersion(reported.stdout);
66
- if (found === null) {
67
- throw new KitRefusal(
68
- "kit_tmux_unsupported",
69
- `this Environment reports "${reported.stdout.trim()}"; ${PREREQUISITE}`,
70
- );
71
- }
72
- if (found[0] < REQUIRED_VERSION[0] || (found[0] === REQUIRED_VERSION[0] && found[1] < REQUIRED_VERSION[1])) {
73
- throw new KitRefusal(
74
- "kit_tmux_unsupported",
75
- `this Environment has tmux ${found[0]}.${found[1]}; ${PREREQUISITE}`,
76
- );
77
- }
78
- await mkdir(join(runtime.configuration, ".."), { recursive: true, mode: 0o700 });
79
- await writeFile(runtime.configuration, NAMESPACE_CONFIGURATION, { mode: 0o600 });
80
- return `${found[0]}.${found[1]}`;
81
- }
82
-
83
- export async function createSession(runtime, options) {
84
- if (!SESSION_NAME.test(options.session)) {
85
- throw new KitRefusal("kit_tmux_session_invalid", options.session);
86
- }
87
- const environment = Object.entries(withoutHouseCredentials(options.environment)).flatMap(
88
- ([name, value]) => ["-e", `${name}=${value}`],
89
- );
90
- const created = await namespaced(runtime, [
91
- "new-session",
92
- "-d",
93
- "-s",
94
- options.session,
95
- "-c",
96
- options.workingDirectory,
97
- ...environment,
98
- "--",
99
- ...options.command,
100
- ]);
101
- if (created.status !== 0) {
102
- throw new KitRefusal("kit_tmux_session_refused", created.stderr.trim() || null);
103
- }
104
- return options.session;
105
- }
106
-
107
- export async function sessionPresent(runtime, session) {
108
- const asked = await namespaced(runtime, ["has-session", "-t", `=${session}`]);
109
- return asked.status === 0;
110
- }
111
-
112
- export async function destroySession(runtime, session) {
113
- const killed = await namespaced(runtime, ["kill-session", "-t", `=${session}`]);
114
- if (killed.status === 0) return true;
115
- if (await sessionPresent(runtime, session)) {
116
- throw new KitRefusal("kit_tmux_session_persistent", session);
117
- }
118
- return false;
119
- }