Skip to content

Commit 92a1439

Browse files
author
Nebutra Mirror Bot
committed
chore: sync from Nebutra-Sailor@7d84f7fb7191069664e873e3cbe318415caaaf50
0 parents  commit 92a1439

16 files changed

Lines changed: 937 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
package:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
16+
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1
17+
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
18+
with:
19+
node-version: 22
20+
cache: pnpm
21+
- run: pnpm install --no-frozen-lockfile --ignore-scripts
22+
- name: Build
23+
run: node -e "process.exit(require('./package.json').scripts?.build ? 0 : 1)" && pnpm build || echo 'no build script'
24+
- name: Typecheck
25+
run: node -e "process.exit(require('./package.json').scripts?.typecheck ? 0 : 1)" && pnpm typecheck || echo 'no typecheck script'
26+
- name: Test
27+
run: node -e "process.exit(require('./package.json').scripts?.test ? 0 : 1)" && pnpm test || echo 'no test script'

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
coverage
4+
.turbo
5+
.DS_Store

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# @nebutra/code-execution
2+
3+
## 0.1.1
4+
5+
### Patch Changes
6+
7+
- Publish registry package metadata under the MIT license.
8+
9+
- Updated dependencies []:
10+
- @nebutra/capability-kit@0.2.1
11+
- @nebutra/errors@0.1.1
12+
- @nebutra/event-log@0.1.1
13+
- @nebutra/execution-policy@0.1.1
14+
- @nebutra/sandbox-runtime@0.1.1

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Nebutra
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

NEBUTRA_SUBREPO.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Nebutra Subrepo Mirror
2+
3+
This repository is generated from `Nebutra/Nebutra-Sailor`.
4+
5+
| Field | Value |
6+
|---|---|
7+
| Package | `@nebutra/code-execution` |
8+
| Source directory | `packages/ai/code-execution` |
9+
| Mirror repo | `Nebutra/code-execution` |
10+
| Cohort | `first-wave` |
11+
12+
Do not treat this mirror as an independent source of truth. Release versions, package metadata, and dependency governance are maintained in the monorepo.

README.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# @nebutra/code-execution
2+
3+
Public mirror for [@nebutra/code-execution](https://www.npmjs.com/package/%40nebutra%2Fcode-execution) from [Nebutra/Nebutra-Sailor](https://github.com/Nebutra/Nebutra-Sailor/tree/main/packages/ai/code-execution).
4+
5+
This repository is generated from the Nebutra Sailor monorepo. Package releases are cut from the monorepo and mirrored here for discovery, standalone cloning, and contribution intake.
6+
7+
- Canonical source: `packages/ai/code-execution` in `Nebutra/Nebutra-Sailor`
8+
- Package registry: npm and GitHub Packages
9+
- Contributions: open issues or PRs here; maintainers port accepted changes back into the monorepo source package
10+
11+
---
12+
Action and observation execution layer backed by `@nebutra/sandbox-runtime`.
13+
14+
This package turns shell, read, edit-by-diff, git, policy, replay, doctor, and
15+
debug actions into structured observations. It owns execution behavior, not
16+
thread state, prompts, model calls, sub-agent scheduling, or UI approval flows.
17+
18+
## Status: WIP
19+
20+
Experimental public package. The package metadata marks it as not production
21+
ready yet because:
22+
23+
- notebook kernel execution is adapter-gated
24+
- remote workspace providers depend on sandbox-runtime configuration
25+
- approval UI is surfaced as observations and is not wired in this package
26+
27+
Use it as a capability layer behind an application runtime that owns approval,
28+
tenant, and UI handoff.
29+
30+
## Installation
31+
32+
```bash
33+
pnpm add @nebutra/code-execution
34+
```
35+
36+
## Usage
37+
38+
```ts
39+
import { CodeExecutor } from "@nebutra/code-execution";
40+
41+
const executor = new CodeExecutor({
42+
tenantId: "org_123",
43+
workspaceRoot: process.cwd(),
44+
});
45+
46+
const observation = await executor.run({
47+
type: "read",
48+
path: "README.md",
49+
});
50+
```
51+
52+
Shell actions route through `@nebutra/sandbox-runtime`:
53+
54+
```ts
55+
const result = await executor.run({
56+
type: "shell",
57+
cmd: "pnpm test",
58+
cwd: ".",
59+
timeoutS: 30,
60+
});
61+
```
62+
63+
## Action Types
64+
65+
| Type | Purpose |
66+
| --- | --- |
67+
| `shell` | Execute a command through the configured sandbox runtime |
68+
| `read` | Read a workspace-relative file, optionally by line range |
69+
| `edit` | Apply an edit-by-diff request to a workspace-relative file |
70+
| `git` | Execute supported git operations through the sandbox path |
71+
| `ipython` | Return an adapter-unavailable observation until a notebook sidecar is configured |
72+
73+
## Observations
74+
75+
The executor returns structured observations instead of raw side effects:
76+
77+
- `shell_output`
78+
- `file_content`
79+
- `edit_applied`
80+
- `error`
81+
82+
Approval requirements are surfaced as `error` observations with the
83+
`ApprovalRequired` kind. The caller is responsible for asking the user and
84+
retrying with `approved: true`.
85+
86+
## Commands
87+
88+
```bash
89+
pnpm exec:doctor
90+
pnpm exec:debug <action_id>
91+
pnpm exec:replay <action_id>
92+
pnpm exec:policy
93+
```
94+
95+
Executable examples live under `examples/`.
96+
97+
## License
98+
99+
MIT

examples/edit-by-diff.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { CodeExecutor } from "@nebutra/code-execution";
2+
3+
const exec = new CodeExecutor({ tenantId: "local", workspaceRoot: process.cwd() });
4+
const observation = await exec.run({
5+
type: "edit",
6+
tenantId: "local",
7+
path: "scratch/example.txt",
8+
diff: [
9+
"--- a/scratch/example.txt",
10+
"+++ b/scratch/example.txt",
11+
"@@ -1 +1 @@",
12+
"-old",
13+
"+new",
14+
"",
15+
].join("\n"),
16+
});
17+
process.stdout.write(`${JSON.stringify(observation, null, 2)}\n`);

examples/policy.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { CodeExecutor } from "@nebutra/code-execution";
2+
3+
const exec = new CodeExecutor({ tenantId: "local" });
4+
const observation = await exec.run({
5+
type: "shell",
6+
tenantId: "local",
7+
cwd: process.cwd(),
8+
cmd: "git push origin main",
9+
});
10+
process.stdout.write(`${JSON.stringify(observation, null, 2)}\n`);

examples/shell.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { CodeExecutor } from "@nebutra/code-execution";
2+
3+
const exec = new CodeExecutor({ tenantId: "local" });
4+
const observation = await exec.run({
5+
type: "shell",
6+
tenantId: "local",
7+
cwd: process.cwd(),
8+
cmd: "echo sandbox ok",
9+
timeoutS: 5,
10+
});
11+
process.stdout.write(`${JSON.stringify(observation, null, 2)}\n`);

package.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"name": "@nebutra/code-execution",
3+
"version": "0.1.1",
4+
"description": "Action and observation execution layer backed by sandbox-runtime",
5+
"private": false,
6+
"license": "MIT",
7+
"type": "module",
8+
"nebutra": {
9+
"status": "wip",
10+
"productionReady": false,
11+
"surface": "execution-capability",
12+
"requires": [
13+
"@nebutra/sandbox-runtime for shell and git execution",
14+
"@nebutra/event-log for standalone action audit"
15+
],
16+
"gaps": [
17+
"Notebook kernel execution is adapter-gated",
18+
"Remote workspace providers depend on sandbox-runtime configuration",
19+
"Approval UI is surfaced as observations; GUI handoff is not wired here"
20+
],
21+
"featureId": "code-execution",
22+
"category": "ai",
23+
"summary": "Shell, read, edit-by-diff, policy, replay, doctor, and debug tools"
24+
},
25+
"main": "./src/index.ts",
26+
"types": "./src/index.ts",
27+
"exports": {
28+
".": "./src/index.ts"
29+
},
30+
"scripts": {
31+
"build": "tsup",
32+
"test": "vitest run",
33+
"typecheck": "tsc --noEmit"
34+
},
35+
"dependencies": {
36+
"@nebutra/capability-kit": "^0.2.1",
37+
"@nebutra/errors": "^0.1.1",
38+
"@nebutra/event-log": "^0.1.1",
39+
"@nebutra/execution-policy": "^0.1.1",
40+
"@nebutra/sandbox-runtime": "^0.1.1"
41+
},
42+
"devDependencies": {
43+
"@types/node": "^25.9.1",
44+
"tsup": "^8.5.1",
45+
"typescript": "^5.9.3",
46+
"vitest": "^4.1.4"
47+
},
48+
"homepage": "https://github.com/Nebutra/code-execution#readme",
49+
"repository": {
50+
"type": "git",
51+
"url": "git+https://github.com/Nebutra/code-execution.git"
52+
},
53+
"bugs": {
54+
"url": "https://github.com/Nebutra/code-execution/issues"
55+
},
56+
"publishConfig": {
57+
"access": "public"
58+
},
59+
"nebutraMirror": {
60+
"sourceRepository": "Nebutra/Nebutra-Sailor",
61+
"sourceDirectory": "packages/ai/code-execution",
62+
"sourcePackage": "@nebutra/code-execution",
63+
"sourceSha": "7d84f7fb7191069664e873e3cbe318415caaaf50",
64+
"canonicalSource": "monorepo"
65+
}
66+
}

0 commit comments

Comments
 (0)