@h-rig/harness-plugin 0.0.6-alpha.186

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 (82) hide show
  1. package/README.md +1 -0
  2. package/dist/bin/rig-agent-dispatch.d.ts +2 -0
  3. package/dist/bin/rig-agent-dispatch.js +826 -0
  4. package/dist/src/agent-command.d.ts +3 -0
  5. package/dist/src/agent-command.js +233 -0
  6. package/dist/src/agent-harness/agent-mode.d.ts +1 -0
  7. package/dist/src/agent-harness/agent-mode.js +48 -0
  8. package/dist/src/agent-harness/agent-wrapper.d.ts +60 -0
  9. package/dist/src/agent-harness/agent-wrapper.js +842 -0
  10. package/dist/src/agent-harness/controlled-bash.d.ts +3 -0
  11. package/dist/src/agent-harness/controlled-bash.js +45 -0
  12. package/dist/src/agent-harness/git-ops.d.ts +2 -0
  13. package/dist/src/agent-harness/git-ops.js +27 -0
  14. package/dist/src/agent-harness/repo-ops.d.ts +14 -0
  15. package/dist/src/agent-harness/repo-ops.js +37 -0
  16. package/dist/src/agent-harness/rig-agent-entrypoint.d.ts +1 -0
  17. package/dist/src/agent-harness/rig-agent-entrypoint.js +1362 -0
  18. package/dist/src/agent-harness/rig-agent.d.ts +2 -0
  19. package/dist/src/agent-harness/rig-agent.js +1324 -0
  20. package/dist/src/agent-harness/runtime-snapshot-config.d.ts +2 -0
  21. package/dist/src/agent-harness/runtime-snapshot-config.js +25 -0
  22. package/dist/src/agent-harness/task-data.d.ts +27 -0
  23. package/dist/src/agent-harness/task-data.js +286 -0
  24. package/dist/src/agent-harness/task-ops.d.ts +10 -0
  25. package/dist/src/agent-harness/task-ops.js +352 -0
  26. package/dist/src/index.d.ts +6 -0
  27. package/dist/src/index.js +4525 -0
  28. package/dist/src/model.d.ts +80 -0
  29. package/dist/src/model.js +64 -0
  30. package/dist/src/pi-command.d.ts +3 -0
  31. package/dist/src/pi-command.js +154 -0
  32. package/dist/src/pi-settings-materializer.d.ts +10 -0
  33. package/dist/src/pi-settings-materializer.js +52 -0
  34. package/dist/src/plugin.d.ts +24 -0
  35. package/dist/src/plugin.js +4486 -0
  36. package/dist/src/profile-command.d.ts +3 -0
  37. package/dist/src/profile-command.js +79 -0
  38. package/dist/src/profile-state.d.ts +7 -0
  39. package/dist/src/profile-state.js +39 -0
  40. package/dist/src/rig-task-run-skill.d.ts +8 -0
  41. package/dist/src/rig-task-run-skill.js +39 -0
  42. package/dist/src/runtime-instructions.d.ts +4 -0
  43. package/dist/src/runtime-instructions.js +26 -0
  44. package/dist/src/runtime-secrets.d.ts +6 -0
  45. package/dist/src/runtime-secrets.js +58 -0
  46. package/dist/src/service.d.ts +14 -0
  47. package/dist/src/service.js +33 -0
  48. package/dist/src/session-asset-materializer-service.d.ts +13 -0
  49. package/dist/src/session-asset-materializer-service.js +164 -0
  50. package/dist/src/session-hook-materializer-service.d.ts +34 -0
  51. package/dist/src/session-hook-materializer-service.js +142 -0
  52. package/dist/src/skill-materializer.d.ts +25 -0
  53. package/dist/src/skill-materializer.js +86 -0
  54. package/dist/src/tooling/browser-tool-entrypoint.d.ts +2 -0
  55. package/dist/src/tooling/browser-tool-entrypoint.js +125 -0
  56. package/dist/src/tooling/browser-tools.d.ts +3 -0
  57. package/dist/src/tooling/browser-tools.js +27 -0
  58. package/dist/src/tooling/claude-router-binary.d.ts +3 -0
  59. package/dist/src/tooling/claude-router-binary.js +62 -0
  60. package/dist/src/tooling/claude-router.d.ts +22 -0
  61. package/dist/src/tooling/claude-router.js +524 -0
  62. package/dist/src/tooling/embedded-native-assets.d.ts +7 -0
  63. package/dist/src/tooling/embedded-native-assets.js +6 -0
  64. package/dist/src/tooling/file-tools.d.ts +5 -0
  65. package/dist/src/tooling/file-tools.js +192 -0
  66. package/dist/src/tooling/gateway.d.ts +4 -0
  67. package/dist/src/tooling/gateway.js +400 -0
  68. package/dist/src/tooling/shell-tools.d.ts +5 -0
  69. package/dist/src/tooling/shell-tools.js +185 -0
  70. package/native/darwin-arm64/rig-shell +0 -0
  71. package/native/darwin-arm64/rig-shell.build-manifest.json +4 -0
  72. package/native/darwin-arm64/rig-tools +0 -0
  73. package/native/darwin-arm64/rig-tools.build-manifest.json +4 -0
  74. package/native/darwin-x64/rig-shell +0 -0
  75. package/native/darwin-x64/rig-tools +0 -0
  76. package/native/linux-arm64/rig-shell +0 -0
  77. package/native/linux-arm64/rig-tools +0 -0
  78. package/native/linux-x64/rig-shell +0 -0
  79. package/native/linux-x64/rig-tools +0 -0
  80. package/native/win32-x64/rig-shell.exe +0 -0
  81. package/native/win32-x64/rig-tools.exe +0 -0
  82. package/package.json +101 -0
@@ -0,0 +1,3 @@
1
+ export declare function runControlledBash(args: string[], options: {
2
+ readonly projectRootFallbackDir: string;
3
+ }): Promise<number>;
@@ -0,0 +1,45 @@
1
+ // @bun
2
+ // packages/harness-plugin/src/agent-harness/controlled-bash.ts
3
+ import { existsSync } from "fs";
4
+ import { resolve } from "path";
5
+ import { resolveRigLayout } from "@rig/core/layout";
6
+ function controlledBashCandidates(projectRoot) {
7
+ const layout = resolveRigLayout(projectRoot);
8
+ const candidates = [
9
+ process.env.RIG_CONTROLLED_BASH_BIN?.trim() || "",
10
+ resolve(layout.binDir, "controlled-bash"),
11
+ Bun.which("controlled-bash") || ""
12
+ ];
13
+ return candidates.filter((candidate) => Boolean(candidate));
14
+ }
15
+ function resolveControlledBash(projectRoot) {
16
+ for (const candidate of controlledBashCandidates(projectRoot)) {
17
+ if (existsSync(candidate))
18
+ return candidate;
19
+ }
20
+ return null;
21
+ }
22
+ async function runControlledBash(args, options) {
23
+ const projectRoot = process.env.RIG_HOST_PROJECT_ROOT?.trim() || process.env.PROJECT_RIG_ROOT?.trim() || process.env.RIG_TASK_WORKSPACE?.trim() || process.cwd() || options.projectRootFallbackDir;
24
+ const controlled = resolveControlledBash(projectRoot);
25
+ if (!controlled) {
26
+ console.error("[rig-agent] controlled-bash entrypoint unavailable; refusing to run an unguarded shell.");
27
+ return 126;
28
+ }
29
+ const command = [controlled, ...args];
30
+ const child = Bun.spawn(command, {
31
+ stdin: "inherit",
32
+ stdout: "inherit",
33
+ stderr: "inherit",
34
+ cwd: process.cwd(),
35
+ env: {
36
+ ...process.env,
37
+ PROJECT_RIG_ROOT: projectRoot,
38
+ RIG_BASH_ACTIVE: "1"
39
+ }
40
+ });
41
+ return await child.exited;
42
+ }
43
+ export {
44
+ runControlledBash
45
+ };
@@ -0,0 +1,2 @@
1
+ import { type LifecycleGitAgentService } from "@rig/contracts";
2
+ export declare function loadLifecycleGit(projectRoot: string): Promise<LifecycleGitAgentService>;
@@ -0,0 +1,27 @@
1
+ // @bun
2
+ // packages/harness-plugin/src/agent-harness/git-ops.ts
3
+ import { LIFECYCLE_GIT_AGENT } from "@rig/contracts";
4
+ import { defineCapability } from "@rig/core/capability";
5
+ import { buildPluginHostContext } from "@rig/core/plugin-host-context";
6
+ import { loadCapabilityForRoot } from "@rig/core/capability-loaders";
7
+ var LifecycleGitAgentCap = defineCapability(LIFECYCLE_GIT_AGENT);
8
+ var hostContextByRoot = new Map;
9
+ async function ensureHostContext(projectRoot) {
10
+ let cached = hostContextByRoot.get(projectRoot);
11
+ if (!cached) {
12
+ cached = buildPluginHostContext(projectRoot);
13
+ hostContextByRoot.set(projectRoot, cached);
14
+ }
15
+ await cached;
16
+ }
17
+ async function loadLifecycleGit(projectRoot) {
18
+ await ensureHostContext(projectRoot);
19
+ const git = await loadCapabilityForRoot(projectRoot, LifecycleGitAgentCap);
20
+ if (!git) {
21
+ throw new Error("lifecycle git capability unavailable: load @rig/lifecycle-plugin (default bundle) before running rig-agent git commands.");
22
+ }
23
+ return git;
24
+ }
25
+ export {
26
+ loadLifecycleGit
27
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Provider agent-harness repo operations.
3
+ *
4
+ * Repo workflow semantics are owned by @rig/repos-plugin. This provider shim only
5
+ * resolves the repo-operations capability and delegates the legacy harness entry
6
+ * points so provider code does not perform live git/branch/task-source mutation.
7
+ */
8
+ import { type RepoPins } from "@rig/contracts";
9
+ export declare function repoEnsure(projectRoot: string, taskId?: string): void;
10
+ export declare function repoPins(projectRoot: string, taskId?: string): RepoPins;
11
+ export declare function repoVerify(projectRoot: string, taskId?: string): boolean;
12
+ export declare function repoDiscover(projectRoot: string, taskId?: string): RepoPins;
13
+ export declare function repoBaseline(projectRoot: string, refresh?: boolean): RepoPins;
14
+ export declare function resetBaseline(projectRoot: string, keepTaskStatus: boolean): void;
@@ -0,0 +1,37 @@
1
+ // @bun
2
+ // packages/harness-plugin/src/agent-harness/repo-ops.ts
3
+ import {
4
+ REPO_OPERATIONS_CAPABILITY
5
+ } from "@rig/contracts";
6
+ import { defineCapability } from "@rig/core/capability";
7
+ import { requireInstalledCapability } from "@rig/core/capability-loaders";
8
+ var RepoOperationsCap = defineCapability(REPO_OPERATIONS_CAPABILITY);
9
+ function repoOperations() {
10
+ return requireInstalledCapability(RepoOperationsCap, "repo operations capability unavailable: load @rig/repos-plugin before using provider harness repo operations.");
11
+ }
12
+ function repoEnsure(projectRoot, taskId) {
13
+ repoOperations().repoEnsure(projectRoot, taskId);
14
+ }
15
+ function repoPins(projectRoot, taskId) {
16
+ return repoOperations().repoPins(projectRoot, taskId);
17
+ }
18
+ function repoVerify(projectRoot, taskId) {
19
+ return repoOperations().repoVerify(projectRoot, taskId);
20
+ }
21
+ function repoDiscover(projectRoot, taskId) {
22
+ return repoOperations().repoDiscover(projectRoot, taskId);
23
+ }
24
+ function repoBaseline(projectRoot, refresh = false) {
25
+ return repoOperations().repoBaseline(projectRoot, refresh);
26
+ }
27
+ function resetBaseline(projectRoot, keepTaskStatus) {
28
+ repoOperations().resetBaseline(projectRoot, keepTaskStatus);
29
+ }
30
+ export {
31
+ resetBaseline,
32
+ repoVerify,
33
+ repoPins,
34
+ repoEnsure,
35
+ repoDiscover,
36
+ repoBaseline
37
+ };
@@ -0,0 +1 @@
1
+ export declare function runRigAgentEntrypoint(): Promise<void>;