@geminixiang/mikan 1.0.0-beta.39 → 1.0.0-beta.40
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/CHANGELOG.md +21 -0
- package/README.md +50 -23
- package/dist/adapter.d.ts +1 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js.map +1 -1
- package/dist/adapters/discord/bot.d.ts +2 -1
- package/dist/adapters/discord/bot.d.ts.map +1 -1
- package/dist/adapters/discord/bot.js +3 -3
- package/dist/adapters/discord/bot.js.map +1 -1
- package/dist/adapters/discord/context.d.ts +2 -1
- package/dist/adapters/discord/context.d.ts.map +1 -1
- package/dist/adapters/discord/context.js +1 -1
- package/dist/adapters/discord/context.js.map +1 -1
- package/dist/adapters/github/bot.d.ts +2 -1
- package/dist/adapters/github/bot.d.ts.map +1 -1
- package/dist/adapters/github/bot.js +11 -7
- package/dist/adapters/github/bot.js.map +1 -1
- package/dist/adapters/github/client.js +2 -2
- package/dist/adapters/github/client.js.map +1 -1
- package/dist/adapters/github/context.d.ts +4 -2
- package/dist/adapters/github/context.d.ts.map +1 -1
- package/dist/adapters/github/context.js +2 -2
- package/dist/adapters/github/context.js.map +1 -1
- package/dist/adapters/github/gcp-auth.js +2 -2
- package/dist/adapters/github/gcp-auth.js.map +1 -1
- package/dist/adapters/github/github-ops.d.ts +3 -2
- package/dist/adapters/github/github-ops.d.ts.map +1 -1
- package/dist/adapters/github/github-ops.js +1 -1
- package/dist/adapters/github/github-ops.js.map +1 -1
- package/dist/adapters/github/ids.d.ts.map +1 -1
- package/dist/adapters/github/ids.js +7 -3
- package/dist/adapters/github/ids.js.map +1 -1
- package/dist/adapters/github/repo.js +3 -3
- package/dist/adapters/github/repo.js.map +1 -1
- package/dist/adapters/github/types.d.ts +2 -1
- package/dist/adapters/github/types.d.ts.map +1 -1
- package/dist/adapters/github/types.js.map +1 -1
- package/dist/adapters/progressive-renderer.js +1 -1
- package/dist/adapters/progressive-renderer.js.map +1 -1
- package/dist/adapters/shared.js +4 -4
- package/dist/adapters/shared.js.map +1 -1
- package/dist/adapters/slack/blocks.d.ts.map +1 -1
- package/dist/adapters/slack/blocks.js +3 -1
- package/dist/adapters/slack/blocks.js.map +1 -1
- package/dist/adapters/slack/bot.d.ts +12 -2
- package/dist/adapters/slack/bot.d.ts.map +1 -1
- package/dist/adapters/slack/bot.js +70 -9
- package/dist/adapters/slack/bot.js.map +1 -1
- package/dist/adapters/slack/context.d.ts +2 -1
- package/dist/adapters/slack/context.d.ts.map +1 -1
- package/dist/adapters/slack/context.js +1 -0
- package/dist/adapters/slack/context.js.map +1 -1
- package/dist/adapters/slack/response-lifecycle.d.ts.map +1 -1
- package/dist/adapters/slack/response-lifecycle.js +4 -4
- package/dist/adapters/slack/response-lifecycle.js.map +1 -1
- package/dist/adapters/slack/session.d.ts.map +1 -1
- package/dist/adapters/slack/session.js +2 -3
- package/dist/adapters/slack/session.js.map +1 -1
- package/dist/adapters/slack/tools/attach.js +1 -1
- package/dist/adapters/slack/tools/attach.js.map +1 -1
- package/dist/adapters/telegram/bot.d.ts +2 -1
- package/dist/adapters/telegram/bot.d.ts.map +1 -1
- package/dist/adapters/telegram/bot.js +6 -6
- package/dist/adapters/telegram/bot.js.map +1 -1
- package/dist/adapters/telegram/context.d.ts +2 -1
- package/dist/adapters/telegram/context.d.ts.map +1 -1
- package/dist/adapters/telegram/context.js.map +1 -1
- package/dist/adapters/telegram/html.d.ts.map +1 -1
- package/dist/adapters/telegram/html.js +10 -7
- package/dist/adapters/telegram/html.js.map +1 -1
- package/dist/adapters/types.d.ts +4 -2
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/adapters/types.js.map +1 -1
- package/dist/agent-events.d.ts +3 -2
- package/dist/agent-events.d.ts.map +1 -1
- package/dist/agent-events.js +19 -1
- package/dist/agent-events.js.map +1 -1
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +34 -9
- package/dist/agent.js.map +1 -1
- package/dist/cli/arg-grammar.d.ts.map +1 -1
- package/dist/cli/arg-grammar.js +5 -3
- package/dist/cli/arg-grammar.js.map +1 -1
- package/dist/cli/boot.d.ts.map +1 -1
- package/dist/cli/boot.js +5 -3
- package/dist/cli/boot.js.map +1 -1
- package/dist/cli/download.d.ts.map +1 -1
- package/dist/cli/download.js +2 -0
- package/dist/cli/download.js.map +1 -1
- package/dist/cli/ext-dev.d.ts.map +1 -1
- package/dist/cli/ext-dev.js +4 -1
- package/dist/cli/ext-dev.js.map +1 -1
- package/dist/cli/ext.d.ts.map +1 -1
- package/dist/cli/ext.js +123 -23
- package/dist/cli/ext.js.map +1 -1
- package/dist/cli/office.d.ts.map +1 -1
- package/dist/cli/office.js +2 -0
- package/dist/cli/office.js.map +1 -1
- package/dist/cli/types.d.ts +0 -6
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/types.js.map +1 -1
- package/dist/commands/admin.js +1 -1
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/auto-reply.js +2 -2
- package/dist/commands/auto-reply.js.map +1 -1
- package/dist/commands/extensions.js +1 -1
- package/dist/commands/extensions.js.map +1 -1
- package/dist/commands/login.js +1 -1
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/manifest.d.ts +7 -0
- package/dist/commands/manifest.d.ts.map +1 -1
- package/dist/commands/manifest.js +28 -0
- package/dist/commands/manifest.js.map +1 -1
- package/dist/commands/model.d.ts.map +1 -1
- package/dist/commands/model.js +4 -1
- package/dist/commands/model.js.map +1 -1
- package/dist/commands/new.js +1 -1
- package/dist/commands/new.js.map +1 -1
- package/dist/commands/sandbox.js +3 -3
- package/dist/commands/sandbox.js.map +1 -1
- package/dist/commands/session-view.d.ts.map +1 -1
- package/dist/commands/session-view.js +5 -2
- package/dist/commands/session-view.js.map +1 -1
- package/dist/commands/types.d.ts +1 -1
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/types.js.map +1 -1
- package/dist/config.js +4 -4
- package/dist/config.js.map +1 -1
- package/dist/env-manifest.d.ts +2 -0
- package/dist/env-manifest.d.ts.map +1 -1
- package/dist/env-manifest.js +11 -1
- package/dist/env-manifest.js.map +1 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +7 -6
- package/dist/events.js.map +1 -1
- package/dist/execution-resolver.d.ts.map +1 -1
- package/dist/execution-resolver.js +3 -2
- package/dist/execution-resolver.js.map +1 -1
- package/dist/extension-schedules.d.ts +31 -0
- package/dist/extension-schedules.d.ts.map +1 -0
- package/dist/extension-schedules.js +229 -0
- package/dist/extension-schedules.js.map +1 -0
- package/dist/harness/auth.js +5 -5
- package/dist/harness/auth.js.map +1 -1
- package/dist/harness/event-format.d.ts +2 -0
- package/dist/harness/event-format.d.ts.map +1 -1
- package/dist/harness/event-format.js +2 -1
- package/dist/harness/event-format.js.map +1 -1
- package/dist/harness/extensions/loader.d.ts +2 -2
- package/dist/harness/extensions/loader.d.ts.map +1 -1
- package/dist/harness/extensions/loader.js +135 -33
- package/dist/harness/extensions/loader.js.map +1 -1
- package/dist/harness/extensions/registry.d.ts +33 -1
- package/dist/harness/extensions/registry.d.ts.map +1 -1
- package/dist/harness/extensions/registry.js +79 -2
- package/dist/harness/extensions/registry.js.map +1 -1
- package/dist/harness/extensions/types.d.ts +165 -21
- package/dist/harness/extensions/types.d.ts.map +1 -1
- package/dist/harness/extensions/types.js.map +1 -1
- package/dist/harness/index.d.ts +2 -2
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +1 -1
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/models.d.ts.map +1 -1
- package/dist/harness/models.js +36 -24
- package/dist/harness/models.js.map +1 -1
- package/dist/harness/runner.js +2 -2
- package/dist/harness/runner.js.map +1 -1
- package/dist/harness/session-store.d.ts.map +1 -1
- package/dist/harness/session-store.js +9 -7
- package/dist/harness/session-store.js.map +1 -1
- package/dist/harness/skills.js +3 -3
- package/dist/harness/skills.js.map +1 -1
- package/dist/harness/subagent-profiles.js +2 -2
- package/dist/harness/subagent-profiles.js.map +1 -1
- package/dist/harness/subagent-runner.js +3 -3
- package/dist/harness/subagent-runner.js.map +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/main.js +58 -9
- package/dist/main.js.map +1 -1
- package/dist/observability/instrument.js +1 -1
- package/dist/observability/instrument.js.map +1 -1
- package/dist/observability/sentry.js +1 -1
- package/dist/observability/sentry.js.map +1 -1
- package/dist/office/index.d.ts +1 -1
- package/dist/office/index.d.ts.map +1 -1
- package/dist/office/index.js +1 -1
- package/dist/office/index.js.map +1 -1
- package/dist/office/layout.d.ts +7 -0
- package/dist/office/layout.d.ts.map +1 -1
- package/dist/office/layout.js +10 -1
- package/dist/office/layout.js.map +1 -1
- package/dist/office/registry.d.ts.map +1 -1
- package/dist/office/registry.js +7 -5
- package/dist/office/registry.js.map +1 -1
- package/dist/packages/materialize.js +10 -3
- package/dist/packages/materialize.js.map +1 -1
- package/dist/packages/source.d.ts +6 -0
- package/dist/packages/source.d.ts.map +1 -1
- package/dist/packages/source.js +14 -2
- package/dist/packages/source.js.map +1 -1
- package/dist/packages/types.d.ts +5 -3
- package/dist/packages/types.d.ts.map +1 -1
- package/dist/packages/types.js.map +1 -1
- package/dist/provisioner.js +5 -5
- package/dist/provisioner.js.map +1 -1
- package/dist/runtime/conversation-runtime.d.ts.map +1 -1
- package/dist/runtime/conversation-runtime.js +44 -2
- package/dist/runtime/conversation-runtime.js.map +1 -1
- package/dist/runtime/types.d.ts +10 -2
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/types.js.map +1 -1
- package/dist/sandbox/cloudflare.js +1 -1
- package/dist/sandbox/cloudflare.js.map +1 -1
- package/dist/sandbox/container.js +1 -2
- package/dist/sandbox/container.js.map +1 -1
- package/dist/sandbox/firecracker.js +1 -1
- package/dist/sandbox/firecracker.js.map +1 -1
- package/dist/sandbox/gondolin.d.ts.map +1 -1
- package/dist/sandbox/gondolin.js +1 -2
- package/dist/sandbox/gondolin.js.map +1 -1
- package/dist/sandbox/host.d.ts.map +1 -1
- package/dist/sandbox/host.js +4 -5
- package/dist/sandbox/host.js.map +1 -1
- package/dist/sandbox/index.js +1 -1
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/utils.d.ts +2 -0
- package/dist/sandbox/utils.d.ts.map +1 -1
- package/dist/sandbox/utils.js +30 -1
- package/dist/sandbox/utils.js.map +1 -1
- package/dist/sessions/chat-history-sync.d.ts.map +1 -1
- package/dist/sessions/chat-history-sync.js +9 -8
- package/dist/sessions/chat-history-sync.js.map +1 -1
- package/dist/sessions/conversation-log.d.ts.map +1 -1
- package/dist/sessions/conversation-log.js +5 -2
- package/dist/sessions/conversation-log.js.map +1 -1
- package/dist/sessions/history-line.d.ts +9 -0
- package/dist/sessions/history-line.d.ts.map +1 -1
- package/dist/sessions/history-line.js +22 -1
- package/dist/sessions/history-line.js.map +1 -1
- package/dist/sessions/session-key.d.ts +5 -12
- package/dist/sessions/session-key.d.ts.map +1 -1
- package/dist/sessions/session-key.js +23 -0
- package/dist/sessions/session-key.js.map +1 -1
- package/dist/sessions/store.d.ts +2 -6
- package/dist/sessions/store.d.ts.map +1 -1
- package/dist/sessions/store.js +16 -16
- package/dist/sessions/store.js.map +1 -1
- package/dist/sessions/types.d.ts +2 -1
- package/dist/sessions/types.d.ts.map +1 -1
- package/dist/sessions/types.js.map +1 -1
- package/dist/tools/bash.js +1 -1
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/edit.d.ts.map +1 -1
- package/dist/tools/edit.js +4 -1
- package/dist/tools/edit.js.map +1 -1
- package/dist/tools/event.js +1 -1
- package/dist/tools/event.js.map +1 -1
- package/dist/tools/generate-image.js +3 -3
- package/dist/tools/generate-image.js.map +1 -1
- package/dist/tools/read.js +4 -4
- package/dist/tools/read.js.map +1 -1
- package/dist/tools/subagent.d.ts.map +1 -1
- package/dist/tools/subagent.js +9 -2
- package/dist/tools/subagent.js.map +1 -1
- package/dist/tools/types.d.ts +0 -26
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js.map +1 -1
- package/dist/trigger.d.ts +2 -1
- package/dist/trigger.d.ts.map +1 -1
- package/dist/trigger.js.map +1 -1
- package/dist/types.d.ts +108 -16
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -2
- package/dist/types.js.map +1 -1
- package/dist/utils/file-guards.d.ts +9 -0
- package/dist/utils/file-guards.d.ts.map +1 -1
- package/dist/utils/file-guards.js +44 -1
- package/dist/utils/file-guards.js.map +1 -1
- package/dist/vault/disabled.d.ts.map +1 -1
- package/dist/vault/disabled.js +3 -0
- package/dist/vault/disabled.js.map +1 -1
- package/dist/vault/index.d.ts +29 -0
- package/dist/vault/index.d.ts.map +1 -1
- package/dist/vault/index.js +68 -4
- package/dist/vault/index.js.map +1 -1
- package/dist/vault/types.d.ts +2 -0
- package/dist/vault/types.d.ts.map +1 -1
- package/dist/vault/types.js.map +1 -1
- package/dist/web/admin/portal.d.ts +1 -1
- package/dist/web/admin/portal.d.ts.map +1 -1
- package/dist/web/admin/portal.js +194 -22
- package/dist/web/admin/portal.js.map +1 -1
- package/dist/web/admin/provider-models.js +1 -1
- package/dist/web/admin/provider-models.js.map +1 -1
- package/dist/web/login/oauth.js +1 -1
- package/dist/web/login/oauth.js.map +1 -1
- package/dist/web/login/portal.d.ts +1 -1
- package/dist/web/login/portal.d.ts.map +1 -1
- package/dist/web/login/portal.js +13 -36
- package/dist/web/login/portal.js.map +1 -1
- package/dist/web/portal-shell.d.ts +17 -0
- package/dist/web/portal-shell.d.ts.map +1 -1
- package/dist/web/portal-shell.js +66 -1
- package/dist/web/portal-shell.js.map +1 -1
- package/dist/web/server.d.ts +3 -2
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +3 -3
- package/dist/web/server.js.map +1 -1
- package/dist/web/session-view/portal.d.ts +1 -1
- package/dist/web/session-view/portal.d.ts.map +1 -1
- package/dist/web/session-view/portal.js +10 -12
- package/dist/web/session-view/portal.js.map +1 -1
- package/dist/web/session-view/service.d.ts.map +1 -1
- package/dist/web/session-view/service.js +11 -6
- package/dist/web/session-view/service.js.map +1 -1
- package/dist/web/session-view/types.d.ts +0 -4
- package/dist/web/session-view/types.d.ts.map +1 -1
- package/dist/web/session-view/types.js.map +1 -1
- package/dist/web/token-store.js +1 -1
- package/dist/web/token-store.js.map +1 -1
- package/package.json +8 -17
- package/dist/cli/ext-git.d.ts +0 -17
- package/dist/cli/ext-git.d.ts.map +0 -1
- package/dist/cli/ext-git.js +0 -107
- package/dist/cli/ext-git.js.map +0 -1
- package/dist/commands/parse.d.ts +0 -7
- package/dist/commands/parse.d.ts.map +0 -1
- package/dist/commands/parse.js +0 -14
- package/dist/commands/parse.js.map +0 -1
- package/dist/commands/text.d.ts +0 -2
- package/dist/commands/text.d.ts.map +0 -1
- package/dist/commands/text.js +0 -16
- package/dist/commands/text.js.map +0 -1
- package/dist/harness/extensions/blockkit.d.ts +0 -19
- package/dist/harness/extensions/blockkit.d.ts.map +0 -1
- package/dist/harness/extensions/blockkit.js +0 -42
- package/dist/harness/extensions/blockkit.js.map +0 -1
- package/dist/sandbox/path-context.d.ts +0 -3
- package/dist/sandbox/path-context.d.ts.map +0 -1
- package/dist/sandbox/path-context.js +0 -30
- package/dist/sandbox/path-context.js.map +0 -1
- package/dist/sessions/metadata.d.ts +0 -3
- package/dist/sessions/metadata.d.ts.map +0 -1
- package/dist/sessions/metadata.js +0 -11
- package/dist/sessions/metadata.js.map +0 -1
- package/dist/sessions/policy.d.ts +0 -6
- package/dist/sessions/policy.d.ts.map +0 -1
- package/dist/sessions/policy.js +0 -25
- package/dist/sessions/policy.js.map +0 -1
- package/dist/tools/truncate.d.ts +0 -33
- package/dist/tools/truncate.d.ts.map +0 -1
- package/dist/tools/truncate.js +0 -184
- package/dist/tools/truncate.js.map +0 -1
- package/dist/utils/date.d.ts +0 -10
- package/dist/utils/date.d.ts.map +0 -1
- package/dist/utils/date.js +0 -23
- package/dist/utils/date.js.map +0 -1
- package/dist/utils/env.d.ts +0 -3
- package/dist/utils/env.d.ts.map +0 -1
- package/dist/utils/env.js +0 -12
- package/dist/utils/env.js.map +0 -1
- package/dist/utils/fs-atomic.d.ts +0 -10
- package/dist/utils/fs-atomic.d.ts.map +0 -1
- package/dist/utils/fs-atomic.js +0 -45
- package/dist/utils/fs-atomic.js.map +0 -1
- package/dist/utils/html.d.ts +0 -2
- package/dist/utils/html.d.ts.map +0 -1
- package/dist/utils/html.js +0 -4
- package/dist/utils/html.js.map +0 -1
- package/dist/utils/http-body.d.ts +0 -10
- package/dist/utils/http-body.d.ts.map +0 -1
- package/dist/utils/http-body.js +0 -34
- package/dist/utils/http-body.js.map +0 -1
- package/dist/vault/injection.d.ts +0 -12
- package/dist/vault/injection.d.ts.map +0 -1
- package/dist/vault/injection.js +0 -30
- package/dist/vault/injection.js.map +0 -1
- package/dist/vault/policy.d.ts +0 -20
- package/dist/vault/policy.d.ts.map +0 -1
- package/dist/vault/policy.js +0 -20
- package/dist/vault/policy.js.map +0 -1
- package/dist/web/agent-events/portal.d.ts +0 -3
- package/dist/web/agent-events/portal.d.ts.map +0 -1
- package/dist/web/agent-events/portal.js +0 -19
- package/dist/web/agent-events/portal.js.map +0 -1
- package/dist/web/request.d.ts +0 -3
- package/dist/web/request.d.ts.map +0 -1
- package/dist/web/request.js +0 -13
- package/dist/web/request.js.map +0 -1
- package/dist/web/session-view/command.d.ts +0 -4
- package/dist/web/session-view/command.d.ts.map +0 -1
- package/dist/web/session-view/command.js +0 -10
- package/dist/web/session-view/command.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path-context.d.ts","sourceRoot":"","sources":["../../src/sandbox/path-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,+BAA+B,CAC7C,iBAAiB,EAAE,MAAM,EACzB,oBAAoB,EAAE,MAAM,GAC3B,kBAAkB,CAOpB"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
2
|
-
export function createMountedRuntimePathContext(hostWorkspaceRoot, runtimeWorkspaceRoot) {
|
|
3
|
-
return {
|
|
4
|
-
hostWorkspaceRoot,
|
|
5
|
-
runtimeWorkspaceRoot,
|
|
6
|
-
runtimeToHostPath: (runtimePath) => translateMountedRuntimePathToHost(runtimePath, runtimeWorkspaceRoot, hostWorkspaceRoot),
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
function translateMountedRuntimePathToHost(runtimePath, runtimeWorkspaceRoot, hostWorkspaceRoot) {
|
|
10
|
-
if (!isAbsolute(runtimePath)) {
|
|
11
|
-
return runtimePath;
|
|
12
|
-
}
|
|
13
|
-
const runtimeRoot = resolve(runtimeWorkspaceRoot);
|
|
14
|
-
const normalizedRuntimePath = resolve(runtimePath);
|
|
15
|
-
const runtimeRelativePath = relative(runtimeRoot, normalizedRuntimePath);
|
|
16
|
-
const escapesRuntimeRoot = runtimeRelativePath === ".." ||
|
|
17
|
-
runtimeRelativePath.startsWith(`..${sep}`) ||
|
|
18
|
-
isAbsolute(runtimeRelativePath);
|
|
19
|
-
if (escapesRuntimeRoot) {
|
|
20
|
-
return runtimePath;
|
|
21
|
-
}
|
|
22
|
-
const hostRoot = resolve(hostWorkspaceRoot);
|
|
23
|
-
const hostPath = resolve(hostRoot, runtimeRelativePath);
|
|
24
|
-
const hostRelativePath = relative(hostRoot, hostPath);
|
|
25
|
-
const escapesHostRoot = hostRelativePath === ".." ||
|
|
26
|
-
hostRelativePath.startsWith(`..${sep}`) ||
|
|
27
|
-
isAbsolute(hostRelativePath);
|
|
28
|
-
return escapesHostRoot ? runtimePath : hostPath;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=path-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path-context.js","sourceRoot":"","sources":["../../src/s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AC;IAE/B,OAAO,eAAe,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;AAClD,CAAC","sourcesContent":["import { isAbsolute, relative, resolve, sep } from \"node:path\";\nimport type { RuntimePathContext } from \"./types.js\";\n\nexport function createMountedRuntimePathContext(\n hostWorkspaceRoot: string,\n runtimeWorkspaceRoot: string,\n): RuntimePathContext {\n return {\n hostWorkspaceRoot,\n runtimeWorkspaceRoot,\n runtimeToHostPath: (runtimePath) =>\n translateMountedRuntimePathToHost(runtimePath, runtimeWorkspaceRoot, hostWorkspaceRoot),\n };\n}\n\nfunction translateMountedRuntimePathToHost(\n runtimePath: string,\n runtimeWorkspaceRoot: string,\n hostWorkspaceRoot: string,\n): string {\n if (!isAbsolute(runtimePath)) {\n return runtimePath;\n }\n\n const runtimeRoot = resolve(runtimeWorkspaceRoot);\n const normalizedRuntimePath = resolve(runtimePath);\n const runtimeRelativePath = relative(runtimeRoot, normalizedRuntimePath);\n const escapesRuntimeRoot =\n runtimeRelativePath === \"..\" ||\n runtimeRelativePath.startsWith(`..${sep}`) ||\n isAbsolute(runtimeRelativePath);\n\n if (escapesRuntimeRoot) {\n return runtimePath;\n }\n\n const hostRoot = resolve(hostWorkspaceRoot);\n const hostPath = resolve(hostRoot, runtimeRelativePath);\n const hostRelativePath = relative(hostRoot, hostPath);\n const escapesHostRoot =\n hostRelativePath === \"..\" ||\n hostRelativePath.startsWith(`..${sep}`) ||\n isAbsolute(hostRelativePath);\n\n return escapesHostRoot ? runtimePath : hostPath;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/sessions/metadata.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGrD,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAOrE"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { SessionStore } from "../harness/index.js";
|
|
2
|
-
export function isPlatformHistorySession(sessionFile) {
|
|
3
|
-
try {
|
|
4
|
-
const header = SessionStore.open(sessionFile).getHeader();
|
|
5
|
-
return header?.source?.kind === "platform-history";
|
|
6
|
-
}
|
|
7
|
-
catch {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=metadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/sessions/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAInD,MAAM,UAAU,wBAAwB,CAAC,WAAmB;IAC1D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,SAAS,EAA+B,CAAC;QACvF,OAAO,MAAM,EAAE,MAAM,EAAE,IAAI,KAAK,kBAAkB,CAAC;IACrD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["import { SessionStore } from \"../harness/index.js\";\nexport type { MikanSessionHeader } from \"./types.js\";\nimport type { MikanSessionHeader } from \"./types.js\";\n\nexport function isPlatformHistorySession(sessionFile: string): boolean {\n try {\n const header = SessionStore.open(sessionFile).getHeader() as MikanSessionHeader | null;\n return header?.source?.kind === \"platform-history\";\n } catch {\n return false;\n }\n}\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ConversationKind } from "../adapter.js";
|
|
2
|
-
export type { ResolveSessionKeyOptions } from "./types.js";
|
|
3
|
-
import type { ResolveSessionKeyOptions } from "./types.js";
|
|
4
|
-
export declare function resolveChatSessionKey(options: ResolveSessionKeyOptions): string;
|
|
5
|
-
export declare function inferConversationKind(platform: string, conversationId: string): ConversationKind;
|
|
6
|
-
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/sessions/policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,YAAY,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE3D,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,wBAAwB,GAAG,MAAM,CAgB/E;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,gBAAgB,CAehG"}
|
package/dist/sessions/policy.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { assertConversationId, makeThreadSessionKey } from "./session-key.js";
|
|
2
|
-
export function resolveChatSessionKey(options) {
|
|
3
|
-
const { conversationId, conversationKind, messageId, persistentTopLevel, scopeDirectThreads, threadTs, } = options;
|
|
4
|
-
if (conversationKind === "direct" && (!threadTs || !scopeDirectThreads)) {
|
|
5
|
-
return assertConversationId(conversationId);
|
|
6
|
-
}
|
|
7
|
-
if (!threadTs && persistentTopLevel) {
|
|
8
|
-
return assertConversationId(conversationId);
|
|
9
|
-
}
|
|
10
|
-
return makeThreadSessionKey(conversationId, threadTs || messageId);
|
|
11
|
-
}
|
|
12
|
-
export function inferConversationKind(platform, conversationId) {
|
|
13
|
-
if (platform === "slack") {
|
|
14
|
-
return conversationId.startsWith("D") ? "direct" : "shared";
|
|
15
|
-
}
|
|
16
|
-
if (platform === "telegram") {
|
|
17
|
-
return conversationId.startsWith("-") ? "shared" : "direct";
|
|
18
|
-
}
|
|
19
|
-
if (platform === "discord") {
|
|
20
|
-
return conversationId.startsWith("DM") ? "direct" : "shared";
|
|
21
|
-
}
|
|
22
|
-
// github: issues/PRs are always shared within the repo; there are no DMs.
|
|
23
|
-
return "shared";
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=policy.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,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import type { ConversationKind } from \"../adapter.js\";\nimport { assertConversationId, makeThreadSessionKey } from \"./session-key.js\";\nexport type { ResolveSessionKeyOptions } from \"./types.js\";\nimport type { ResolveSessionKeyOptions } from \"./types.js\";\n\nexport function resolveChatSessionKey(options: ResolveSessionKeyOptions): string {\n const {\n conversationId,\n conversationKind,\n messageId,\n persistentTopLevel,\n scopeDirectThreads,\n threadTs,\n } = options;\n if (conversationKind === \"direct\" && (!threadTs || !scopeDirectThreads)) {\n return assertConversationId(conversationId);\n }\n if (!threadTs && persistentTopLevel) {\n return assertConversationId(conversationId);\n }\n return makeThreadSessionKey(conversationId, threadTs || messageId);\n}\n\nexport function inferConversationKind(platform: string, conversationId: string): ConversationKind {\n if (platform === \"slack\") {\n return conversationId.startsWith(\"D\") ? \"direct\" : \"shared\";\n }\n\n if (platform === \"telegram\") {\n return conversationId.startsWith(\"-\") ? \"shared\" : \"direct\";\n }\n\n if (platform === \"discord\") {\n return conversationId.startsWith(\"DM\") ? \"direct\" : \"shared\";\n }\n\n // github: issues/PRs are always shared within the repo; there are no DMs.\n return \"shared\";\n}\n"]}
|
package/dist/tools/truncate.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared truncation utilities for tool outputs.
|
|
3
|
-
*
|
|
4
|
-
* Truncation is based on two independent limits - whichever is hit first wins:
|
|
5
|
-
* - Line limit (default: 2000 lines)
|
|
6
|
-
* - Byte limit (default: 50KB)
|
|
7
|
-
*
|
|
8
|
-
* Never returns partial lines (except bash tail truncation edge case).
|
|
9
|
-
*/
|
|
10
|
-
export declare const DEFAULT_MAX_LINES = 2000;
|
|
11
|
-
export declare const DEFAULT_MAX_BYTES: number;
|
|
12
|
-
export type { TruncationOptions, TruncationResult } from "./types.js";
|
|
13
|
-
import type { TruncationOptions, TruncationResult } from "./types.js";
|
|
14
|
-
/**
|
|
15
|
-
* Format bytes as human-readable size.
|
|
16
|
-
*/
|
|
17
|
-
export declare function formatSize(bytes: number): string;
|
|
18
|
-
/**
|
|
19
|
-
* Truncate content from the head (keep first N lines/bytes).
|
|
20
|
-
* Suitable for file reads where you want to see the beginning.
|
|
21
|
-
*
|
|
22
|
-
* Never returns partial lines. If first line exceeds byte limit,
|
|
23
|
-
* returns empty content with firstLineExceedsLimit=true.
|
|
24
|
-
*/
|
|
25
|
-
export declare function truncateHead(content: string, options?: TruncationOptions): TruncationResult;
|
|
26
|
-
/**
|
|
27
|
-
* Truncate content from the tail (keep last N lines/bytes).
|
|
28
|
-
* Suitable for bash output where you want to see the end (errors, final results).
|
|
29
|
-
*
|
|
30
|
-
* May return partial first line if the last line of original content exceeds byte limit.
|
|
31
|
-
*/
|
|
32
|
-
export declare function truncateTail(content: string, options?: TruncationOptions): TruncationResult;
|
|
33
|
-
//# sourceMappingURL=truncate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"truncate.d.ts","sourceRoot":"","sources":["../../src/tools/truncate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,eAAO,MAAM,iBAAiB,QAAY,CAAC;AAE3C,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEtE;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQhD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,gBAAgB,CA4E/F;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,gBAAgB,CAqE/F"}
|
package/dist/tools/truncate.js
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared truncation utilities for tool outputs.
|
|
3
|
-
*
|
|
4
|
-
* Truncation is based on two independent limits - whichever is hit first wins:
|
|
5
|
-
* - Line limit (default: 2000 lines)
|
|
6
|
-
* - Byte limit (default: 50KB)
|
|
7
|
-
*
|
|
8
|
-
* Never returns partial lines (except bash tail truncation edge case).
|
|
9
|
-
*/
|
|
10
|
-
export const DEFAULT_MAX_LINES = 2000;
|
|
11
|
-
export const DEFAULT_MAX_BYTES = 50 * 1024; // 50KB
|
|
12
|
-
/**
|
|
13
|
-
* Format bytes as human-readable size.
|
|
14
|
-
*/
|
|
15
|
-
export function formatSize(bytes) {
|
|
16
|
-
if (bytes < 1024) {
|
|
17
|
-
return `${bytes}B`;
|
|
18
|
-
}
|
|
19
|
-
else if (bytes < 1024 * 1024) {
|
|
20
|
-
return `${(bytes / 1024).toFixed(1)}KB`;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Truncate content from the head (keep first N lines/bytes).
|
|
28
|
-
* Suitable for file reads where you want to see the beginning.
|
|
29
|
-
*
|
|
30
|
-
* Never returns partial lines. If first line exceeds byte limit,
|
|
31
|
-
* returns empty content with firstLineExceedsLimit=true.
|
|
32
|
-
*/
|
|
33
|
-
export function truncateHead(content, options = {}) {
|
|
34
|
-
const maxLines = options.maxLines ?? DEFAULT_MAX_LINES;
|
|
35
|
-
const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
36
|
-
const totalBytes = Buffer.byteLength(content, "utf-8");
|
|
37
|
-
const lines = content.split("\n");
|
|
38
|
-
const totalLines = lines.length;
|
|
39
|
-
// Check if no truncation needed
|
|
40
|
-
if (totalLines <= maxLines && totalBytes <= maxBytes) {
|
|
41
|
-
return {
|
|
42
|
-
content,
|
|
43
|
-
truncated: false,
|
|
44
|
-
truncatedBy: null,
|
|
45
|
-
totalLines,
|
|
46
|
-
totalBytes,
|
|
47
|
-
outputLines: totalLines,
|
|
48
|
-
outputBytes: totalBytes,
|
|
49
|
-
lastLinePartial: false,
|
|
50
|
-
firstLineExceedsLimit: false,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
// Check if first line alone exceeds byte limit
|
|
54
|
-
const firstLineBytes = Buffer.byteLength(lines[0], "utf-8");
|
|
55
|
-
if (firstLineBytes > maxBytes) {
|
|
56
|
-
return {
|
|
57
|
-
content: "",
|
|
58
|
-
truncated: true,
|
|
59
|
-
truncatedBy: "bytes",
|
|
60
|
-
totalLines,
|
|
61
|
-
totalBytes,
|
|
62
|
-
outputLines: 0,
|
|
63
|
-
outputBytes: 0,
|
|
64
|
-
lastLinePartial: false,
|
|
65
|
-
firstLineExceedsLimit: true,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
// Collect complete lines that fit
|
|
69
|
-
const outputLinesArr = [];
|
|
70
|
-
let outputBytesCount = 0;
|
|
71
|
-
let truncatedBy = "lines";
|
|
72
|
-
for (let i = 0; i < lines.length && i < maxLines; i++) {
|
|
73
|
-
const line = lines[i];
|
|
74
|
-
const lineBytes = Buffer.byteLength(line, "utf-8") + (i > 0 ? 1 : 0); // +1 for newline
|
|
75
|
-
if (outputBytesCount + lineBytes > maxBytes) {
|
|
76
|
-
truncatedBy = "bytes";
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
outputLinesArr.push(line);
|
|
80
|
-
outputBytesCount += lineBytes;
|
|
81
|
-
}
|
|
82
|
-
// If we exited due to line limit
|
|
83
|
-
if (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {
|
|
84
|
-
truncatedBy = "lines";
|
|
85
|
-
}
|
|
86
|
-
const outputContent = outputLinesArr.join("\n");
|
|
87
|
-
const finalOutputBytes = Buffer.byteLength(outputContent, "utf-8");
|
|
88
|
-
return {
|
|
89
|
-
content: outputContent,
|
|
90
|
-
truncated: true,
|
|
91
|
-
truncatedBy,
|
|
92
|
-
totalLines,
|
|
93
|
-
totalBytes,
|
|
94
|
-
outputLines: outputLinesArr.length,
|
|
95
|
-
outputBytes: finalOutputBytes,
|
|
96
|
-
lastLinePartial: false,
|
|
97
|
-
firstLineExceedsLimit: false,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Truncate content from the tail (keep last N lines/bytes).
|
|
102
|
-
* Suitable for bash output where you want to see the end (errors, final results).
|
|
103
|
-
*
|
|
104
|
-
* May return partial first line if the last line of original content exceeds byte limit.
|
|
105
|
-
*/
|
|
106
|
-
export function truncateTail(content, options = {}) {
|
|
107
|
-
const maxLines = options.maxLines ?? DEFAULT_MAX_LINES;
|
|
108
|
-
const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
109
|
-
const totalBytes = Buffer.byteLength(content, "utf-8");
|
|
110
|
-
const lines = content.split("\n");
|
|
111
|
-
const totalLines = lines.length;
|
|
112
|
-
// Check if no truncation needed
|
|
113
|
-
if (totalLines <= maxLines && totalBytes <= maxBytes) {
|
|
114
|
-
return {
|
|
115
|
-
content,
|
|
116
|
-
truncated: false,
|
|
117
|
-
truncatedBy: null,
|
|
118
|
-
totalLines,
|
|
119
|
-
totalBytes,
|
|
120
|
-
outputLines: totalLines,
|
|
121
|
-
outputBytes: totalBytes,
|
|
122
|
-
lastLinePartial: false,
|
|
123
|
-
firstLineExceedsLimit: false,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
// Work backwards from the end
|
|
127
|
-
const outputLinesArr = [];
|
|
128
|
-
let outputBytesCount = 0;
|
|
129
|
-
let truncatedBy = "lines";
|
|
130
|
-
let lastLinePartial = false;
|
|
131
|
-
for (let i = lines.length - 1; i >= 0 && outputLinesArr.length < maxLines; i--) {
|
|
132
|
-
const line = lines[i];
|
|
133
|
-
const lineBytes = Buffer.byteLength(line, "utf-8") + (outputLinesArr.length > 0 ? 1 : 0); // +1 for newline
|
|
134
|
-
if (outputBytesCount + lineBytes > maxBytes) {
|
|
135
|
-
truncatedBy = "bytes";
|
|
136
|
-
// Edge case: if we haven't added ANY lines yet and this line exceeds maxBytes,
|
|
137
|
-
// take the end of the line (partial)
|
|
138
|
-
if (outputLinesArr.length === 0) {
|
|
139
|
-
const truncatedLine = truncateStringToBytesFromEnd(line, maxBytes);
|
|
140
|
-
outputLinesArr.unshift(truncatedLine);
|
|
141
|
-
outputBytesCount = Buffer.byteLength(truncatedLine, "utf-8");
|
|
142
|
-
lastLinePartial = true;
|
|
143
|
-
}
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
outputLinesArr.unshift(line);
|
|
147
|
-
outputBytesCount += lineBytes;
|
|
148
|
-
}
|
|
149
|
-
// If we exited due to line limit
|
|
150
|
-
if (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {
|
|
151
|
-
truncatedBy = "lines";
|
|
152
|
-
}
|
|
153
|
-
const outputContent = outputLinesArr.join("\n");
|
|
154
|
-
const finalOutputBytes = Buffer.byteLength(outputContent, "utf-8");
|
|
155
|
-
return {
|
|
156
|
-
content: outputContent,
|
|
157
|
-
truncated: true,
|
|
158
|
-
truncatedBy,
|
|
159
|
-
totalLines,
|
|
160
|
-
totalBytes,
|
|
161
|
-
outputLines: outputLinesArr.length,
|
|
162
|
-
outputBytes: finalOutputBytes,
|
|
163
|
-
lastLinePartial,
|
|
164
|
-
firstLineExceedsLimit: false,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Truncate a string to fit within a byte limit (from the end).
|
|
169
|
-
* Handles multi-byte UTF-8 characters correctly.
|
|
170
|
-
*/
|
|
171
|
-
function truncateStringToBytesFromEnd(str, maxBytes) {
|
|
172
|
-
const buf = Buffer.from(str, "utf-8");
|
|
173
|
-
if (buf.length <= maxBytes) {
|
|
174
|
-
return str;
|
|
175
|
-
}
|
|
176
|
-
// Start from the end, skip maxBytes back
|
|
177
|
-
let start = buf.length - maxBytes;
|
|
178
|
-
// Find a valid UTF-8 boundary (start of a character)
|
|
179
|
-
while (start < buf.length && (buf[start] & 0xc0) === 0x80) {
|
|
180
|
-
start++;
|
|
181
|
-
}
|
|
182
|
-
return buf.slice(start).toString("utf-8");
|
|
183
|
-
}
|
|
184
|
-
//# sourceMappingURL=truncate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"truncate.js","sourceRoot":"","sources":["../../src/tools/truncate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AACtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO;AAKnD;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,IAAI,KAAK,GAAG,IAAI,EAAE,CAAC;QACjB,OAAO,GAAG,KAAK,GAAG,CAAC;IACrB,CAAC;SAAM,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;QAC/B,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1C,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IACnD,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,OAAO,GAAsB,EAAE;IAC3E,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,iBAAiB,CAAC;IACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,iBAAiB,CAAC;IAEvD,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,OAAO,C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AAI,CAAC,CAAC;QAC7B,gBAAgB,IAAI,SAAS,CAAC;IAChC,CAAC;IAED,iCAAiC;IACjC,IAAI,cAAc,CAAC,MAAM,IAAI,QAAQ,IAAI,gBAAgB,IAAI,QAAQ,EAAE,CAAC;QACtE,WAAW,GAAG,OAAO,CAAC;IACxB,CAAC;IAED,MAAM,aAAa,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAEnE,OAAO;QACL,OAAO,EAAE,aAAa;QACtB,SAAS,EAAE,IAAI;QACf,WAAW;QACX,UAAU;QACV,UAAU;QACV,WAAW,EAAE,cAAc,CAAC,MAAM;QAClC,WAAW,EAAE,gBAAgB;QAC7B,eAAe;QACf,qBAAqB,EAAE,KAAK;KAC7B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,4BAA4B,CAAC,GAAW,EAAE,QAAgB;IACjE,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACtC,IAAI,GAAG,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC3B,OAAO,GAAG,CAAC;IACb,CAAC;IAED,yCAAyC;IACzC,IAAI,KAAK,GAAG,GAAG,CAAC,MAAM,GAAG,QAAQ,CAAC;IAElC,qDAAqD;IACrD,OAAO,KAAK,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QAC1D,KAAK,EAAE,CAAC;IACV,CAAC;IAED,OAAO,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["/**\n * Shared truncation utilities for tool outputs.\n *\n * Truncation is based on two independent limits - whichever is hit first wins:\n * - Line limit (default: 2000 lines)\n * - Byte limit (default: 50KB)\n *\n * Never returns partial lines (except bash tail truncation edge case).\n */\n\nexport const DEFAULT_MAX_LINES = 2000;\nexport const DEFAULT_MAX_BYTES = 50 * 1024; // 50KB\n\nexport type { TruncationOptions, TruncationResult } from \"./types.js\";\nimport type { TruncationOptions, TruncationResult } from \"./types.js\";\n\n/**\n * Format bytes as human-readable size.\n */\nexport function formatSize(bytes: number): string {\n if (bytes < 1024) {\n return `${bytes}B`;\n } else if (bytes < 1024 * 1024) {\n return `${(bytes / 1024).toFixed(1)}KB`;\n } else {\n return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;\n }\n}\n\n/**\n * Truncate content from the head (keep first N lines/bytes).\n * Suitable for file reads where you want to see the beginning.\n *\n * Never returns partial lines. If first line exceeds byte limit,\n * returns empty content with firstLineExceedsLimit=true.\n */\nexport function truncateHead(content: string, options: TruncationOptions = {}): TruncationResult {\n const maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n const totalBytes = Buffer.byteLength(content, \"utf-8\");\n const lines = content.split(\"\\n\");\n const totalLines = lines.length;\n\n // Check if no truncation needed\n if (totalLines <= maxLines && totalBytes <= maxBytes) {\n return {\n content,\n truncated: false,\n truncatedBy: null,\n totalLines,\n totalBytes,\n outputLines: totalLines,\n outputBytes: totalBytes,\n lastLinePartial: false,\n firstLineExceedsLimit: false,\n };\n }\n\n // Check if first line alone exceeds byte limit\n const firstLineBytes = Buffer.byteLength(lines[0], \"utf-8\");\n if (firstLineBytes > maxBytes) {\n return {\n content: \"\",\n truncated: true,\n truncatedBy: \"bytes\",\n totalLines,\n totalBytes,\n outputLines: 0,\n outputBytes: 0,\n lastLinePartial: false,\n firstLineExceedsLimit: true,\n };\n }\n\n // Collect complete lines that fit\n const outputLinesArr: string[] = [];\n let outputBytesCount = 0;\n let truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n\n for (let i = 0; i < lines.length && i < maxLines; i++) {\n const line = lines[i];\n const lineBytes = Buffer.byteLength(line, \"utf-8\") + (i > 0 ? 1 : 0); // +1 for newline\n\n if (outputBytesCount + lineBytes > maxBytes) {\n truncatedBy = \"bytes\";\n break;\n }\n\n outputLinesArr.push(line);\n outputBytesCount += lineBytes;\n }\n\n // If we exited due to line limit\n if (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n truncatedBy = \"lines\";\n }\n\n const outputContent = outputLinesArr.join(\"\\n\");\n const finalOutputBytes = Buffer.byteLength(outputContent, \"utf-8\");\n\n return {\n content: outputContent,\n truncated: true,\n truncatedBy,\n totalLines,\n totalBytes,\n outputLines: outputLinesArr.length,\n outputBytes: finalOutputBytes,\n lastLinePartial: false,\n firstLineExceedsLimit: false,\n };\n}\n\n/**\n * Truncate content from the tail (keep last N lines/bytes).\n * Suitable for bash output where you want to see the end (errors, final results).\n *\n * May return partial first line if the last line of original content exceeds byte limit.\n */\nexport function truncateTail(content: string, options: TruncationOptions = {}): TruncationResult {\n const maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;\n\n const totalBytes = Buffer.byteLength(content, \"utf-8\");\n const lines = content.split(\"\\n\");\n const totalLines = lines.length;\n\n // Check if no truncation needed\n if (totalLines <= maxLines && totalBytes <= maxBytes) {\n return {\n content,\n truncated: false,\n truncatedBy: null,\n totalLines,\n totalBytes,\n outputLines: totalLines,\n outputBytes: totalBytes,\n lastLinePartial: false,\n firstLineExceedsLimit: false,\n };\n }\n\n // Work backwards from the end\n const outputLinesArr: string[] = [];\n let outputBytesCount = 0;\n let truncatedBy: \"lines\" | \"bytes\" = \"lines\";\n let lastLinePartial = false;\n\n for (let i = lines.length - 1; i >= 0 && outputLinesArr.length < maxLines; i--) {\n const line = lines[i];\n const lineBytes = Buffer.byteLength(line, \"utf-8\") + (outputLinesArr.length > 0 ? 1 : 0); // +1 for newline\n\n if (outputBytesCount + lineBytes > maxBytes) {\n truncatedBy = \"bytes\";\n // Edge case: if we haven't added ANY lines yet and this line exceeds maxBytes,\n // take the end of the line (partial)\n if (outputLinesArr.length === 0) {\n const truncatedLine = truncateStringToBytesFromEnd(line, maxBytes);\n outputLinesArr.unshift(truncatedLine);\n outputBytesCount = Buffer.byteLength(truncatedLine, \"utf-8\");\n lastLinePartial = true;\n }\n break;\n }\n\n outputLinesArr.unshift(line);\n outputBytesCount += lineBytes;\n }\n\n // If we exited due to line limit\n if (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {\n truncatedBy = \"lines\";\n }\n\n const outputContent = outputLinesArr.join(\"\\n\");\n const finalOutputBytes = Buffer.byteLength(outputContent, \"utf-8\");\n\n return {\n content: outputContent,\n truncated: true,\n truncatedBy,\n totalLines,\n totalBytes,\n outputLines: outputLinesArr.length,\n outputBytes: finalOutputBytes,\n lastLinePartial,\n firstLineExceedsLimit: false,\n };\n}\n\n/**\n * Truncate a string to fit within a byte limit (from the end).\n * Handles multi-byte UTF-8 characters correctly.\n */\nfunction truncateStringToBytesFromEnd(str: string, maxBytes: number): string {\n const buf = Buffer.from(str, \"utf-8\");\n if (buf.length <= maxBytes) {\n return str;\n }\n\n // Start from the end, skip maxBytes back\n let start = buf.length - maxBytes;\n\n // Find a valid UTF-8 boundary (start of a character)\n while (start < buf.length && (buf[start] & 0xc0) === 0x80) {\n start++;\n }\n\n return buf.slice(start).toString(\"utf-8\");\n}\n"]}
|
package/dist/utils/date.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Format a Date as a local-timezone timestamp string: YYYY-MM-DD HH:MM:SS±HH:MM
|
|
3
|
-
* Returns null when the date is invalid (non-finite time value).
|
|
4
|
-
*
|
|
5
|
-
* This format is used both when writing user messages (agent.ts) and when
|
|
6
|
-
* reading history back into sessions (chat-history-sync.ts). Keeping it
|
|
7
|
-
* in one place ensures normalizeComparableText's regex stays valid.
|
|
8
|
-
*/
|
|
9
|
-
export declare function formatLocalTimestamp(date: Date): string | null;
|
|
10
|
-
//# sourceMappingURL=date.d.ts.map
|
package/dist/utils/date.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAY9D"}
|
package/dist/utils/date.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Format a Date as a local-timezone timestamp string: YYYY-MM-DD HH:MM:SS±HH:MM
|
|
3
|
-
* Returns null when the date is invalid (non-finite time value).
|
|
4
|
-
*
|
|
5
|
-
* This format is used both when writing user messages (agent.ts) and when
|
|
6
|
-
* reading history back into sessions (chat-history-sync.ts). Keeping it
|
|
7
|
-
* in one place ensures normalizeComparableText's regex stays valid.
|
|
8
|
-
*/
|
|
9
|
-
export function formatLocalTimestamp(date) {
|
|
10
|
-
const time = date.getTime();
|
|
11
|
-
if (!Number.isFinite(time))
|
|
12
|
-
return null;
|
|
13
|
-
const offset = -date.getTimezoneOffset();
|
|
14
|
-
const sign = offset >= 0 ? "+" : "-";
|
|
15
|
-
const abs = Math.abs(offset);
|
|
16
|
-
return (`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ` +
|
|
17
|
-
`${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}` +
|
|
18
|
-
`${sign}${pad(Math.floor(abs / 60))}:${pad(abs % 60)}`);
|
|
19
|
-
}
|
|
20
|
-
function pad(n) {
|
|
21
|
-
return n.toString().padStart(2, "0");
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=date.js.map
|
package/dist/utils/date.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAU;IAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAExC,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;IACzC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACrC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,OAAO,CACL,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG;QAC3E,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE;QAC7E,GAAG,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,CACvD,CAAC;AACJ,CAAC;AAED,SAAS,GAAG,CAAC,CAAS;IACpB,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/**\n * Format a Date as a local-timezone timestamp string: YYYY-MM-DD HH:MM:SS±HH:MM\n * Returns null when the date is invalid (non-finite time value).\n *\n * This format is used both when writing user messages (agent.ts) and when\n * reading history back into sessions (chat-history-sync.ts). Keeping it\n * in one place ensures normalizeComparableText's regex stays valid.\n */\nexport function formatLocalTimestamp(date: Date): string | null {\n const time = date.getTime();\n if (!Number.isFinite(time)) return null;\n\n const offset = -date.getTimezoneOffset();\n const sign = offset >= 0 ? \"+\" : \"-\";\n const abs = Math.abs(offset);\n return (\n `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ` +\n `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}` +\n `${sign}${pad(Math.floor(abs / 60))}:${pad(abs % 60)}`\n );\n}\n\nfunction pad(n: number): string {\n return n.toString().padStart(2, \"0\");\n}\n"]}
|
package/dist/utils/env.d.ts
DELETED
package/dist/utils/env.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/utils/env.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMxD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAG/D"}
|
package/dist/utils/env.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export function readEnv(name) {
|
|
2
|
-
const raw = process.env[name]?.trim();
|
|
3
|
-
if (raw)
|
|
4
|
-
return raw;
|
|
5
|
-
const prefixed = process.env[`MIKAN_${name}`]?.trim();
|
|
6
|
-
return prefixed || undefined;
|
|
7
|
-
}
|
|
8
|
-
export function setEnvAliases(name, value) {
|
|
9
|
-
process.env[name] = value;
|
|
10
|
-
process.env[`MIKAN_${name}`] = value;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=env.js.map
|
package/dist/utils/env.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/utils/env.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;IACtC,IAAI,GAAG;QAAE,OAAO,GAAG,CAAC;IAEpB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC;IACtD,OAAO,QAAQ,IAAI,SAAS,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,KAAa;IACvD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC;AACvC,CAAC","sourcesContent":["export function readEnv(name: string): string | undefined {\n const raw = process.env[name]?.trim();\n if (raw) return raw;\n\n const prefixed = process.env[`MIKAN_${name}`]?.trim();\n return prefixed || undefined;\n}\n\nexport function setEnvAliases(name: string, value: string): void {\n process.env[name] = value;\n process.env[`MIKAN_${name}`] = value;\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Write `content` to `targetPath` with mode 0600, even when `targetPath`
|
|
3
|
-
* already exists. Uses O_CREAT|O_EXCL on a temp sibling (so the kernel
|
|
4
|
-
* guarantees permissions at creation, not after a racy chmod) and then
|
|
5
|
-
* rename(2) into place for atomicity. Readers never see a torn write,
|
|
6
|
-
* and a crash mid-write leaves either the old file or a stray .tmp
|
|
7
|
-
* (cleaned by the next attempt or manually) — never a half-written target.
|
|
8
|
-
*/
|
|
9
|
-
export declare function atomicWritePrivateFile(targetPath: string, content: string): void;
|
|
10
|
-
//# sourceMappingURL=fs-atomic.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fs-atomic.d.ts","sourceRoot":"","sources":["../../src/utils/fs-atomic.ts"],"names":[],"mappings":"AAaA;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAiChF"}
|
package/dist/utils/fs-atomic.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { closeSync, constants as fsConstants, openSync, renameSync, unlinkSync, writeSync, } from "fs";
|
|
2
|
-
import { randomBytes } from "crypto";
|
|
3
|
-
import { basename, dirname, join } from "path";
|
|
4
|
-
const PRIVATE_FILE_MODE = 0o600;
|
|
5
|
-
/**
|
|
6
|
-
* Write `content` to `targetPath` with mode 0600, even when `targetPath`
|
|
7
|
-
* already exists. Uses O_CREAT|O_EXCL on a temp sibling (so the kernel
|
|
8
|
-
* guarantees permissions at creation, not after a racy chmod) and then
|
|
9
|
-
* rename(2) into place for atomicity. Readers never see a torn write,
|
|
10
|
-
* and a crash mid-write leaves either the old file or a stray .tmp
|
|
11
|
-
* (cleaned by the next attempt or manually) — never a half-written target.
|
|
12
|
-
*/
|
|
13
|
-
export function atomicWritePrivateFile(targetPath, content) {
|
|
14
|
-
const dir = dirname(targetPath);
|
|
15
|
-
const tmpPath = join(dir, `.${basename(targetPath)}.${process.pid}.${randomBytes(8).toString("hex")}.tmp`);
|
|
16
|
-
const fd = openSync(tmpPath, fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_EXCL, PRIVATE_FILE_MODE);
|
|
17
|
-
try {
|
|
18
|
-
writeSync(fd, content);
|
|
19
|
-
}
|
|
20
|
-
catch (err) {
|
|
21
|
-
try {
|
|
22
|
-
unlinkSync(tmpPath);
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
// ignore — original error is more informative
|
|
26
|
-
}
|
|
27
|
-
throw err;
|
|
28
|
-
}
|
|
29
|
-
finally {
|
|
30
|
-
closeSync(fd);
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
renameSync(tmpPath, targetPath);
|
|
34
|
-
}
|
|
35
|
-
catch (err) {
|
|
36
|
-
try {
|
|
37
|
-
unlinkSync(tmpPath);
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
// ignore
|
|
41
|
-
}
|
|
42
|
-
throw err;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=fs-atomic.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fs-atomic.js","sourceRoot":"","sources":["../../src/utils/fs-atomic.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,SAAS,IAAI,WAAW,EACxB,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,GACV,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE/C,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEhC;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAkB,EAAE,OAAe;IACxE,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAChC,MAAM,OAAO,GAAG,IAAI,CAClB,GAAG,EACH,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAChF,CAAC;IACF,MAAM,EAAE,GAAG,QAAQ,CACjB,OAAO,EACP,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,MAAM,EAC/D,iBAAiB,CAClB,CAAC;IACF,IAAI,CAAC;QACH,SAAS,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC;YACH,UAAU,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;QAAC,MAAM,CAAC;YACP,8CAA8C;QAChD,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;YAAS,CAAC;QACT,SAAS,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC;IACD,IAAI,CAAC;QACH,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC;YACH,UAAU,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC","sourcesContent":["import {\n closeSync,\n constants as fsConstants,\n openSync,\n renameSync,\n unlinkSync,\n writeSync,\n} from \"fs\";\nimport { randomBytes } from \"crypto\";\nimport { basename, dirname, join } from \"path\";\n\nconst PRIVATE_FILE_MODE = 0o600;\n\n/**\n * Write `content` to `targetPath` with mode 0600, even when `targetPath`\n * already exists. Uses O_CREAT|O_EXCL on a temp sibling (so the kernel\n * guarantees permissions at creation, not after a racy chmod) and then\n * rename(2) into place for atomicity. Readers never see a torn write,\n * and a crash mid-write leaves either the old file or a stray .tmp\n * (cleaned by the next attempt or manually) — never a half-written target.\n */\nexport function atomicWritePrivateFile(targetPath: string, content: string): void {\n const dir = dirname(targetPath);\n const tmpPath = join(\n dir,\n `.${basename(targetPath)}.${process.pid}.${randomBytes(8).toString(\"hex\")}.tmp`,\n );\n const fd = openSync(\n tmpPath,\n fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_EXCL,\n PRIVATE_FILE_MODE,\n );\n try {\n writeSync(fd, content);\n } catch (err) {\n try {\n unlinkSync(tmpPath);\n } catch {\n // ignore — original error is more informative\n }\n throw err;\n } finally {\n closeSync(fd);\n }\n try {\n renameSync(tmpPath, targetPath);\n } catch (err) {\n try {\n unlinkSync(tmpPath);\n } catch {\n // ignore\n }\n throw err;\n }\n}\n"]}
|
package/dist/utils/html.d.ts
DELETED
package/dist/utils/html.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/utils/html.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKhD"}
|
package/dist/utils/html.js
DELETED
package/dist/utils/html.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/utils/html.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,OAAO,CAClB,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAE,CACrF,CAAC;AACJ,CAAC","sourcesContent":["export function escapeHtml(value: string): string {\n return value.replace(\n /[&<>\"']/g,\n (c) => ({ \"&\": \"&\", \"<\": \"<\", \">\": \">\", '\"': \""\", \"'\": \"'\" })[c]!,\n );\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage, ServerResponse } from "http";
|
|
2
|
-
/**
|
|
3
|
-
* Read and size-limit an HTTP request body.
|
|
4
|
-
*
|
|
5
|
-
* Responds with 413 and destroys the request if the body exceeds `maxBytes`.
|
|
6
|
-
* Resolves with the raw body string on success, or `null` if the size limit
|
|
7
|
-
* was exceeded (the response has already been sent in that case).
|
|
8
|
-
*/
|
|
9
|
-
export declare function readRawBody(req: IncomingMessage, res: ServerResponse, maxBytes: number): Promise<string | null>;
|
|
10
|
-
//# sourceMappingURL=http-body.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-body.d.ts","sourceRoot":"","sources":["../../src/utils/http-body.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAE5D;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuBxB"}
|
package/dist/utils/http-body.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Read and size-limit an HTTP request body.
|
|
3
|
-
*
|
|
4
|
-
* Responds with 413 and destroys the request if the body exceeds `maxBytes`.
|
|
5
|
-
* Resolves with the raw body string on success, or `null` if the size limit
|
|
6
|
-
* was exceeded (the response has already been sent in that case).
|
|
7
|
-
*/
|
|
8
|
-
export function readRawBody(req, res, maxBytes) {
|
|
9
|
-
return new Promise((resolve) => {
|
|
10
|
-
let data = "";
|
|
11
|
-
let tooLarge = false;
|
|
12
|
-
req.on("data", (chunk) => {
|
|
13
|
-
if (tooLarge)
|
|
14
|
-
return;
|
|
15
|
-
data += chunk.toString();
|
|
16
|
-
if (data.length > maxBytes) {
|
|
17
|
-
tooLarge = true;
|
|
18
|
-
res.writeHead(413);
|
|
19
|
-
res.end();
|
|
20
|
-
req.destroy();
|
|
21
|
-
resolve(null);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
req.on("end", () => {
|
|
25
|
-
if (!tooLarge)
|
|
26
|
-
resolve(data);
|
|
27
|
-
});
|
|
28
|
-
req.on("error", () => {
|
|
29
|
-
if (!tooLarge)
|
|
30
|
-
resolve(data);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=http-body.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-body.js","sourceRoot":"","sources":["../../src/utils/http-body.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,GAAoB,EACpB,GAAmB,EACnB,QAAgB;IAEhB,OAAO,IAAI,OAAO,CAAgB,CAAC,OAAO,EAAE,EAAE;QAC5C,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,IAAI,QAAQ,GAAG,KAAK,CAAC;QAErB,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;YAC/B,IAAI,QAAQ;gBAAE,OAAO;YACrB,IAAI,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAC;gBAC3B,QAAQ,GAAG,IAAI,CAAC;gBAChB,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;gBACnB,GAAG,CAAC,GAAG,EAAE,CAAC;gBACV,GAAG,CAAC,OAAO,EAAE,CAAC;gBACd,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC;QACH,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YACjB,IAAI,CAAC,QAAQ;gBAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YACnB,IAAI,CAAC,QAAQ;gBAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { IncomingMessage, ServerResponse } from \"http\";\n\n/**\n * Read and size-limit an HTTP request body.\n *\n * Responds with 413 and destroys the request if the body exceeds `maxBytes`.\n * Resolves with the raw body string on success, or `null` if the size limit\n * was exceeded (the response has already been sent in that case).\n */\nexport function readRawBody(\n req: IncomingMessage,\n res: ServerResponse,\n maxBytes: number,\n): Promise<string | null> {\n return new Promise<string | null>((resolve) => {\n let data = \"\";\n let tooLarge = false;\n\n req.on(\"data\", (chunk: Buffer) => {\n if (tooLarge) return;\n data += chunk.toString();\n if (data.length > maxBytes) {\n tooLarge = true;\n res.writeHead(413);\n res.end();\n req.destroy();\n resolve(null);\n }\n });\n req.on(\"end\", () => {\n if (!tooLarge) resolve(data);\n });\n req.on(\"error\", () => {\n if (!tooLarge) resolve(data);\n });\n });\n}\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { SandboxConfig, SandboxCredentialCapabilities } from "../sandbox/types.js";
|
|
2
|
-
import type { OfficeAddress } from "../types.js";
|
|
3
|
-
import type { ResolvedVault, VaultInjection } from "./types.js";
|
|
4
|
-
export type { VaultInjection } from "./types.js";
|
|
5
|
-
export declare function resolveVaultInjection(options: {
|
|
6
|
-
vault: ResolvedVault | undefined;
|
|
7
|
-
capabilities: SandboxCredentialCapabilities;
|
|
8
|
-
sandboxType: SandboxConfig["type"];
|
|
9
|
-
/** Diagnostic identity for error reports only; no injection decision reads it. */
|
|
10
|
-
address: OfficeAddress;
|
|
11
|
-
}): VaultInjection;
|
|
12
|
-
//# sourceMappingURL=injection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"injection.d.ts","sourceRoot":"","sources":["../../src/vault/injection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAsB,cAAc,EAAE,MAAM,YAAY,CAAC;AAEpF,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,KAAK,EAAE,aAAa,GAAG,SAAS,CAAC;IACjC,YAAY,EAAE,6BAA6B,CAAC;IAC5C,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACnC,kFAAkF;IAClF,OAAO,EAAE,aAAa,CAAC;CACxB,GAAG,cAAc,CA6BjB"}
|
package/dist/vault/injection.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "fs";
|
|
2
|
-
import { reportUserFacingError } from "../observability/sentry.js";
|
|
3
|
-
export function resolveVaultInjection(options) {
|
|
4
|
-
const { vault, capabilities, sandboxType, address } = options;
|
|
5
|
-
if (vault && vault.mounts.length > 0 && !capabilities.fileMounts) {
|
|
6
|
-
throw new Error(`Sandbox type "${sandboxType}" does not support vault file mounts`);
|
|
7
|
-
}
|
|
8
|
-
const mounts = [];
|
|
9
|
-
for (const mount of vault?.mounts ?? []) {
|
|
10
|
-
if (!existsSync(mount.source)) {
|
|
11
|
-
reportUserFacingError(new Error("Vault mount source is missing"), {
|
|
12
|
-
domain: "sandbox",
|
|
13
|
-
surface: "vault_injection",
|
|
14
|
-
operation: "resolve_mounts",
|
|
15
|
-
severity: "warning",
|
|
16
|
-
context: {
|
|
17
|
-
sandboxType,
|
|
18
|
-
conversationId: address.conversationId,
|
|
19
|
-
target: mount.target,
|
|
20
|
-
hasVault: Boolean(vault),
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
mounts.push({ source: mount.source, target: mount.target });
|
|
26
|
-
}
|
|
27
|
-
const env = capabilities.env && vault && Object.keys(vault.env).length > 0 ? vault.env : undefined;
|
|
28
|
-
return { ...(env ? { env } : {}), mounts };
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=injection.js.map
|