Skip to content

Commit f5aceba

Browse files
committed
fix: restore dnt build compatibility
1 parent a1b5bc3 commit f5aceba

5 files changed

Lines changed: 53 additions & 12 deletions

File tree

CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
## Development
44

55
```bash
6+
# Readiness check
7+
deno test -A
8+
deno run build
9+
deno task check
10+
deno task lint
11+
deno fmt --check
12+
613
# Format
714
deno fmt
815

docs/ContextOverhaul.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ docs/ContextOverhaulTests.md — add Suite N (pre-tool routing) test cases
812812
- [ ] Policies exist for `Read`, `WebFetch`, `Bash`, `Grep`, `Glob`, `Task`.
813813
- [ ] Hard deny uses thrown errors from `tool.execute.before`.
814814
- [ ] Guidance is emitted at most once per canonical session lineage per type.
815-
- [ ] `deno test` passes; `deno task check` passes.
815+
- [ ] `deno test` passes; `deno run build` passes; `deno task check` passes.
816816

817817
### Phase 2: Pre-tool hook wiring
818818

@@ -834,7 +834,7 @@ docs/ContextOverhaulTests.md — add Suite N (pre-tool routing) test cases
834834
- [ ] The hook fires for parent and child sessions.
835835
- [ ] `tool.execute.before` does not call FalkorDB or Graphiti.
836836
- [ ] Parent and child sessions share one guidance throttle namespace.
837-
- [ ] `deno test` passes; `deno task check` passes.
837+
- [ ] `deno test` passes; `deno run build` passes; `deno task check` passes.
838838

839839
### Phase 3: Heavy-tool policies
840840

@@ -862,7 +862,7 @@ docs/ContextOverhaulTests.md — add Suite N (pre-tool routing) test cases
862862
args.
863863
- [ ] `Glob` does not rely on unsupported exclusion args.
864864
- [ ] `Task` rewrites delegated prompt text with routing instructions.
865-
- [ ] `deno test` passes; `deno task check` passes.
865+
- [ ] `deno test` passes; `deno run build` passes; `deno task check` passes.
866866

867867
### Phase 4: Extraction tightening
868868

@@ -882,7 +882,7 @@ docs/ContextOverhaulTests.md — add Suite N (pre-tool routing) test cases
882882
- [ ] Denied tool calls produce a compact event with the denial reason.
883883
- [ ] Modified/context-guided tool calls produce a compact event noting the
884884
routing action.
885-
- [ ] `deno test` passes; `deno task check` passes.
885+
- [ ] `deno test` passes; `deno run build` passes; `deno task check` passes.
886886

887887
### Phase 5: Snapshot tightening
888888

@@ -900,7 +900,7 @@ docs/ContextOverhaulTests.md — add Suite N (pre-tool routing) test cases
900900
- [ ] Snapshot with 50+ events (including routing events) stays within budget.
901901
- [ ] P0/P1 content (last request, active tasks, decisions) is never dropped.
902902
- [ ] Routing denial events are classified as P2.
903-
- [ ] `deno test` passes; `deno task check` passes.
903+
- [ ] `deno test` passes; `deno run build` passes; `deno task check` passes.
904904

905905
### Phase 6: Integration validation + documentation
906906

@@ -917,8 +917,8 @@ docs/ContextOverhaulTests.md — add Suite N (pre-tool routing) test cases
917917
**Acceptance criteria:**
918918

919919
- [ ] All §3.1.1 alignment criteria (A1–A8) are met.
920-
- [ ] `deno test` passes; `deno task check` passes; `deno lint` passes;
921-
`deno fmt --check` passes.
920+
- [ ] `deno test` passes; `deno run build` passes; `deno task check` passes;
921+
`deno lint` passes; `deno fmt --check` passes.
922922
- [ ] `README.md` documents the pre-tool routing behavior.
923923
- [ ] `AGENTS.md` lists `tool.execute.before` in the hot-path section.
924924
- [ ] `docs/ContextOverhaulTests.md` includes Suite N with ≥ 10 test cases.
@@ -955,6 +955,7 @@ Add to `docs/ContextOverhaulTests.md` as Suite N:
955955
Before merging any part of this plan:
956956

957957
- `deno test`
958+
- `deno run build`
958959
- `deno task check`
959960
- `deno lint`
960961
- `deno fmt --check`

docs/ContextOverhaulTests.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ deno test --allow-net --allow-env --filter "suite-k" src/
666666
# Full run
667667
docker compose -f tests/docker-compose.yml up -d
668668
deno test --allow-net --allow-env src/
669+
deno run build
669670
```
670671

671672
### 9.2 CI Artifacts to Collect

src/services/connection-manager.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,16 @@ const validateEndpoint = (endpoint: string): string => {
124124
try {
125125
new URL(normalized);
126126
} catch (cause) {
127-
throw new Error(
127+
const error = new Error(
128128
`Invalid Graphiti endpoint: ${JSON.stringify(normalized)}`,
129-
{ cause },
130129
);
130+
Object.defineProperty(error, "cause", {
131+
value: cause,
132+
writable: true,
133+
configurable: true,
134+
enumerable: false,
135+
});
136+
throw error;
131137
}
132138

133139
return normalized;

src/services/session-executor.ts

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,37 @@ const clampTimeoutSeconds = (
110110
defaults.maxCommandTimeoutSeconds,
111111
);
112112

113+
type DenoCommandOutput = {
114+
code: number;
115+
stdout: Uint8Array;
116+
stderr: Uint8Array;
117+
};
118+
119+
type DenoCommandInstance = {
120+
output(): Promise<DenoCommandOutput>;
121+
};
122+
123+
type DenoCommandConstructor = new (
124+
command: string | URL,
125+
options?: {
126+
args?: string[];
127+
cwd?: string;
128+
stdin?: "null" | "piped" | "inherit";
129+
stdout?: "null" | "piped" | "inherit";
130+
stderr?: "null" | "piped" | "inherit";
131+
signal?: AbortSignal;
132+
},
133+
) => DenoCommandInstance;
134+
113135
const defaultRunCommand: NonNullable<SessionExecutorOptions["runCommand"]> =
114136
async ({ command, cwd, signal }) => {
115137
const shell = Deno.build.os === "windows"
116138
? { executable: "cmd", args: ["/d", "/s", "/c", command] }
117139
: { executable: "/bin/sh", args: ["-lc", command] };
118-
const output = await new Deno.Command(shell.executable, {
140+
const DenoWithCommand = Deno as typeof Deno & {
141+
Command: DenoCommandConstructor;
142+
};
143+
const output = await new DenoWithCommand.Command(shell.executable, {
119144
args: shell.args,
120145
cwd,
121146
stdin: "null",
@@ -556,14 +581,15 @@ export const createSessionExecutor = (
556581
truncated: false,
557582
};
558583

559-
return await ensureBatchResponseWithinBudget(batchResponse, {
584+
const bounded = await ensureBatchResponseWithinBudget(batchResponse, {
560585
root_session_id: request.root_session_id,
561586
commands: request.commands,
562587
}, {
563588
responseBudgetBytes,
564589
maxNormalizedIndexedBodyBytes,
565590
storeArtifact,
566-
}) as SessionBatchExecuteResponse;
591+
});
592+
return bounded as unknown as SessionBatchExecuteResponse;
567593
},
568594
};
569595
};

0 commit comments

Comments
 (0)