kimi-plugin-cc 3.0.0 → 3.1.0
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +3 -14
- package/README.md +428 -572
- package/assets/logo.svg +6 -0
- package/cordis.patch.yml +18 -0
- package/dist/background-spawn.js +4 -2
- package/dist/cli-client.js +105 -66
- package/dist/commands/ask.js +27 -12
- package/dist/commands/cancel.js +4 -13
- package/dist/commands/cli-helpers.js +1 -1
- package/dist/commands/pursue.js +3 -2
- package/dist/commands/registry.js +7 -26
- package/dist/commands/repair-sessions.js +7 -4
- package/dist/commands/replay.js +4 -3
- package/dist/commands/rescue.js +17 -5
- package/dist/commands/review.js +18 -5
- package/dist/commands/setup.js +277 -262
- package/dist/commands/swarm.js +20 -7
- package/dist/companion.js +142 -18
- package/dist/help.js +11 -7
- package/dist/hook-escape.js +7 -16
- package/dist/hooks/approval-hook.js +1762 -124
- package/dist/hooks/approval-policy.js +15 -10
- package/dist/hooks/config-safety.js +15 -24
- package/dist/hooks/hook-timing.js +1 -1
- package/dist/hooks/install-paths.js +179 -107
- package/dist/hooks/install.js +44 -166
- package/dist/hooks/managed-block.js +44 -95
- package/dist/job-store.js +117 -49
- package/dist/jobs.js +53 -1
- package/dist/kimi-engine.js +68 -92
- package/dist/kimi-errors.js +1 -1
- package/dist/kimi-journal.js +3 -2
- package/dist/kimi-releases.js +28 -49
- package/dist/kimi-timeouts.js +1 -15
- package/dist/kimi-version-probe.js +24 -72
- package/dist/logging.js +12 -7
- package/dist/mcp/binding.js +13 -4
- package/dist/mcp/job-control.js +386 -89
- package/dist/mcp/launcher.js +1 -1
- package/dist/mcp/operations.js +387 -193
- package/dist/mcp/protocol.js +116 -27
- package/dist/mcp/skills.js +130 -0
- package/dist/mcp/stdio.js +15 -2
- package/dist/native-v2-preflight.js +127 -35
- package/dist/parsing.js +45 -11
- package/dist/paths.js +20 -10
- package/dist/plugin-data.js +28 -83
- package/dist/read-scope.js +2 -2
- package/dist/render.js +13 -38
- package/dist/session-references.js +216 -0
- package/dist/session-title.js +1 -1
- package/dist/surface-routing.js +92 -5
- package/dist/swarm-activation.js +26 -137
- package/dist/version.js +1 -1
- package/docs/migration.md +45 -227
- package/docs/models.md +24 -66
- package/docs/safety.md +195 -400
- package/docs/session-visibility.md +24 -14
- package/docs/swarm-recovery.md +26 -20
- package/dsh/index.json +54 -0
- package/mcp_config.json +10 -0
- package/package.json +23 -82
- package/plugin.json +19 -0
- package/plugins/kimi-codex/.codex-plugin/plugin.json +7 -7
- package/plugins/kimi-codex/.mcp.json +2 -3
- package/plugins/kimi-codex/dist/background-spawn.js +4 -2
- package/plugins/kimi-codex/dist/cli-client.js +105 -66
- package/plugins/kimi-codex/dist/commands/ask.js +27 -12
- package/plugins/kimi-codex/dist/commands/cancel.js +4 -13
- package/plugins/kimi-codex/dist/commands/cli-helpers.js +1 -1
- package/plugins/kimi-codex/dist/commands/pursue.js +3 -2
- package/plugins/kimi-codex/dist/commands/registry.js +7 -26
- package/plugins/kimi-codex/dist/commands/repair-sessions.js +7 -4
- package/plugins/kimi-codex/dist/commands/replay.js +4 -3
- package/plugins/kimi-codex/dist/commands/rescue.js +17 -5
- package/plugins/kimi-codex/dist/commands/review.js +18 -5
- package/plugins/kimi-codex/dist/commands/setup.js +277 -262
- package/plugins/kimi-codex/dist/commands/swarm.js +20 -7
- package/plugins/kimi-codex/dist/companion.js +142 -18
- package/plugins/kimi-codex/dist/help.js +11 -7
- package/plugins/kimi-codex/dist/hook-escape.js +7 -16
- package/plugins/kimi-codex/dist/hooks/approval-hook.js +1762 -124
- package/plugins/kimi-codex/dist/hooks/approval-policy.js +15 -10
- package/plugins/kimi-codex/dist/hooks/config-safety.js +15 -24
- package/plugins/kimi-codex/dist/hooks/hook-timing.js +1 -1
- package/plugins/kimi-codex/dist/hooks/install-paths.js +179 -107
- package/plugins/kimi-codex/dist/hooks/install.js +44 -166
- package/plugins/kimi-codex/dist/hooks/managed-block.js +44 -95
- package/plugins/kimi-codex/dist/job-store.js +117 -49
- package/plugins/kimi-codex/dist/jobs.js +53 -1
- package/plugins/kimi-codex/dist/kimi-engine.js +68 -92
- package/plugins/kimi-codex/dist/kimi-errors.js +1 -1
- package/plugins/kimi-codex/dist/kimi-journal.js +3 -2
- package/plugins/kimi-codex/dist/kimi-releases.js +28 -49
- package/plugins/kimi-codex/dist/kimi-timeouts.js +1 -15
- package/plugins/kimi-codex/dist/kimi-version-probe.js +24 -72
- package/plugins/kimi-codex/dist/logging.js +12 -7
- package/plugins/kimi-codex/dist/mcp/binding.js +13 -4
- package/plugins/kimi-codex/dist/mcp/job-control.js +386 -89
- package/plugins/kimi-codex/dist/mcp/launcher.js +1 -1
- package/plugins/kimi-codex/dist/mcp/operations.js +387 -193
- package/plugins/kimi-codex/dist/mcp/protocol.js +116 -27
- package/plugins/kimi-codex/dist/mcp/skills.js +130 -0
- package/plugins/kimi-codex/dist/mcp/stdio.js +15 -2
- package/plugins/kimi-codex/dist/native-v2-preflight.js +127 -35
- package/plugins/kimi-codex/dist/parsing.js +45 -11
- package/plugins/kimi-codex/dist/paths.js +20 -10
- package/plugins/kimi-codex/dist/plugin-data.js +28 -83
- package/plugins/kimi-codex/dist/read-scope.js +2 -2
- package/plugins/kimi-codex/dist/render.js +13 -38
- package/plugins/kimi-codex/dist/session-references.js +216 -0
- package/plugins/kimi-codex/dist/session-title.js +1 -1
- package/plugins/kimi-codex/dist/surface-routing.js +92 -5
- package/plugins/kimi-codex/dist/swarm-activation.js +26 -137
- package/plugins/kimi-codex/dist/version.js +1 -1
- package/plugins/kimi-codex/scripts/companion.sh +4 -15
- package/plugins/kimi-codex/skills/kimi/SKILL.md +77 -0
- package/plugins/kimi-codex/skills/kimi/agents/openai.yaml +6 -0
- package/scripts/companion.sh +4 -15
- package/skills/kimi/SKILL.md +77 -0
- package/skills/kimi/agents/openai.yaml +6 -0
- package/CHANGELOG.md +0 -1402
- package/agents/kimi-pursue.md +0 -93
- package/agents/kimi-review.md +0 -86
- package/agents/kimi-swarm.md +0 -88
- package/agents/kimi-task.md +0 -93
- package/commands/README.md +0 -14
- package/commands/cancel.md +0 -17
- package/commands/pursue.md +0 -41
- package/commands/replay.md +0 -13
- package/commands/result.md +0 -13
- package/commands/review.md +0 -40
- package/commands/setup.md +0 -25
- package/commands/status.md +0 -13
- package/commands/swarm.md +0 -45
- package/commands/task.md +0 -40
- package/dist/commands/review-gate.js +0 -391
- package/dist/config.js +0 -22
- package/dist/dsh/companion.js +0 -177
- package/dist/dsh/index.js +0 -167
- package/dist/hooks/review-gate-stop.js +0 -19
- package/dist/schemas/review-gate-output.js +0 -41
- package/docs/registry-releases.md +0 -228
- package/docs/upstream-2.4.1-certification.md +0 -54
- package/docs/upstream-2.5.0-certification.md +0 -52
- package/docs/upstream-2.5.1-certification.md +0 -47
- package/docs/upstream-2.5.2-certification.md +0 -40
- package/docs/upstream-2.5.3-certification.md +0 -73
- package/docs/upstream-2.6.0-certification.md +0 -65
- package/docs/upstream-2.6.2-certification.md +0 -144
- package/docs/upstream-2.6.3-certification.md +0 -100
- package/docs/upstream-2.7.2-certification.md +0 -113
- package/docs/upstream-2.7.3-certification.md +0 -95
- package/docs/windows-validation.md +0 -39
- package/hooks/README.md +0 -9
- package/hooks/hooks.json +0 -16
- package/plugins/kimi-codex/dist/commands/review-gate.js +0 -391
- package/plugins/kimi-codex/dist/config.js +0 -22
- package/plugins/kimi-codex/dist/dsh/companion.js +0 -177
- package/plugins/kimi-codex/dist/dsh/index.js +0 -167
- package/plugins/kimi-codex/dist/hooks/review-gate-stop.js +0 -19
- package/plugins/kimi-codex/dist/schemas/review-gate-output.js +0 -41
- package/plugins/kimi-codex/scripts/review-gate-hook.sh +0 -32
- package/plugins/kimi-codex/skills/kimi-cancel/SKILL.md +0 -25
- package/plugins/kimi-codex/skills/kimi-cancel/agents/openai.yaml +0 -6
- package/plugins/kimi-codex/skills/kimi-pursue/SKILL.md +0 -32
- package/plugins/kimi-codex/skills/kimi-pursue/agents/openai.yaml +0 -6
- package/plugins/kimi-codex/skills/kimi-replay/SKILL.md +0 -25
- package/plugins/kimi-codex/skills/kimi-replay/agents/openai.yaml +0 -6
- package/plugins/kimi-codex/skills/kimi-result/SKILL.md +0 -25
- package/plugins/kimi-codex/skills/kimi-result/agents/openai.yaml +0 -6
- package/plugins/kimi-codex/skills/kimi-review/SKILL.md +0 -35
- package/plugins/kimi-codex/skills/kimi-review/agents/openai.yaml +0 -6
- package/plugins/kimi-codex/skills/kimi-setup/SKILL.md +0 -35
- package/plugins/kimi-codex/skills/kimi-setup/agents/openai.yaml +0 -6
- package/plugins/kimi-codex/skills/kimi-status/SKILL.md +0 -25
- package/plugins/kimi-codex/skills/kimi-status/agents/openai.yaml +0 -6
- package/plugins/kimi-codex/skills/kimi-swarm/SKILL.md +0 -37
- package/plugins/kimi-codex/skills/kimi-swarm/agents/openai.yaml +0 -6
- package/plugins/kimi-codex/skills/kimi-task/SKILL.md +0 -37
- package/plugins/kimi-codex/skills/kimi-task/agents/openai.yaml +0 -6
- package/plugins/kimi-dsh/LICENSE +0 -201
- package/plugins/kimi-dsh/README.md +0 -84
- package/plugins/kimi-dsh/cordis.patch.yml +0 -45
- package/plugins/kimi-dsh/dist/background-spawn.js +0 -209
- package/plugins/kimi-dsh/dist/cli-cancellation.js +0 -43
- package/plugins/kimi-dsh/dist/cli-client.js +0 -1097
- package/plugins/kimi-dsh/dist/commands/ask.js +0 -269
- package/plugins/kimi-dsh/dist/commands/cancel.js +0 -177
- package/plugins/kimi-dsh/dist/commands/cli-helpers.js +0 -302
- package/plugins/kimi-dsh/dist/commands/models.js +0 -139
- package/plugins/kimi-dsh/dist/commands/pursue.js +0 -293
- package/plugins/kimi-dsh/dist/commands/recover-swarm.js +0 -140
- package/plugins/kimi-dsh/dist/commands/registry.js +0 -74
- package/plugins/kimi-dsh/dist/commands/repair-sessions.js +0 -266
- package/plugins/kimi-dsh/dist/commands/replay.js +0 -124
- package/plugins/kimi-dsh/dist/commands/rescue.js +0 -277
- package/plugins/kimi-dsh/dist/commands/result.js +0 -72
- package/plugins/kimi-dsh/dist/commands/review-gate.js +0 -391
- package/plugins/kimi-dsh/dist/commands/review.js +0 -217
- package/plugins/kimi-dsh/dist/commands/setup.js +0 -1465
- package/plugins/kimi-dsh/dist/commands/status.js +0 -27
- package/plugins/kimi-dsh/dist/commands/swarm.js +0 -823
- package/plugins/kimi-dsh/dist/commands/worker.js +0 -24
- package/plugins/kimi-dsh/dist/companion.js +0 -99
- package/plugins/kimi-dsh/dist/config.js +0 -22
- package/plugins/kimi-dsh/dist/dsh/companion.js +0 -177
- package/plugins/kimi-dsh/dist/dsh/index.js +0 -167
- package/plugins/kimi-dsh/dist/errors.js +0 -40
- package/plugins/kimi-dsh/dist/git.js +0 -216
- package/plugins/kimi-dsh/dist/help.js +0 -43
- package/plugins/kimi-dsh/dist/hook-escape.js +0 -71
- package/plugins/kimi-dsh/dist/hooks/approval-hook.js +0 -145
- package/plugins/kimi-dsh/dist/hooks/approval-policy.js +0 -295
- package/plugins/kimi-dsh/dist/hooks/config-safety.js +0 -641
- package/plugins/kimi-dsh/dist/hooks/hook-timing.js +0 -48
- package/plugins/kimi-dsh/dist/hooks/install-paths.js +0 -428
- package/plugins/kimi-dsh/dist/hooks/install.js +0 -405
- package/plugins/kimi-dsh/dist/hooks/managed-block.js +0 -729
- package/plugins/kimi-dsh/dist/hooks/review-gate-stop.js +0 -19
- package/plugins/kimi-dsh/dist/job-id.js +0 -12
- package/plugins/kimi-dsh/dist/job-store.js +0 -631
- package/plugins/kimi-dsh/dist/jobs.js +0 -212
- package/plugins/kimi-dsh/dist/kimi-command.js +0 -144
- package/plugins/kimi-dsh/dist/kimi-engine.js +0 -770
- package/plugins/kimi-dsh/dist/kimi-errors.js +0 -205
- package/plugins/kimi-dsh/dist/kimi-home.js +0 -15
- package/plugins/kimi-dsh/dist/kimi-journal.js +0 -41
- package/plugins/kimi-dsh/dist/kimi-releases.js +0 -144
- package/plugins/kimi-dsh/dist/kimi-timeouts.js +0 -52
- package/plugins/kimi-dsh/dist/kimi-version-probe.js +0 -198
- package/plugins/kimi-dsh/dist/logging.js +0 -22
- package/plugins/kimi-dsh/dist/mcp/binding.js +0 -58
- package/plugins/kimi-dsh/dist/mcp/job-control.js +0 -343
- package/plugins/kimi-dsh/dist/mcp/launcher.js +0 -263
- package/plugins/kimi-dsh/dist/mcp/operations.js +0 -333
- package/plugins/kimi-dsh/dist/mcp/protocol.js +0 -277
- package/plugins/kimi-dsh/dist/mcp/server.js +0 -8
- package/plugins/kimi-dsh/dist/mcp/stdio.js +0 -79
- package/plugins/kimi-dsh/dist/mcp/supervised-child.js +0 -15
- package/plugins/kimi-dsh/dist/mcp/tool-result.js +0 -7
- package/plugins/kimi-dsh/dist/mcp/workspace.js +0 -34
- package/plugins/kimi-dsh/dist/model-command.js +0 -34
- package/plugins/kimi-dsh/dist/native-v2-preflight.js +0 -596
- package/plugins/kimi-dsh/dist/package.json +0 -1
- package/plugins/kimi-dsh/dist/parsing.js +0 -554
- package/plugins/kimi-dsh/dist/paths.js +0 -35
- package/plugins/kimi-dsh/dist/plugin-data.js +0 -98
- package/plugins/kimi-dsh/dist/process-tree.js +0 -597
- package/plugins/kimi-dsh/dist/prompt-size.js +0 -18
- package/plugins/kimi-dsh/dist/read-scope.js +0 -435
- package/plugins/kimi-dsh/dist/render.js +0 -214
- package/plugins/kimi-dsh/dist/rescue-approval.js +0 -1242
- package/plugins/kimi-dsh/dist/schemas/review-gate-output.js +0 -41
- package/plugins/kimi-dsh/dist/session-recovery.js +0 -202
- package/plugins/kimi-dsh/dist/session-title.js +0 -313
- package/plugins/kimi-dsh/dist/stream-json.js +0 -344
- package/plugins/kimi-dsh/dist/surface-routing.js +0 -21
- package/plugins/kimi-dsh/dist/swarm-activation.js +0 -1194
- package/plugins/kimi-dsh/dist/swarm-policy.js +0 -74
- package/plugins/kimi-dsh/dist/swarm-recovery.js +0 -166
- package/plugins/kimi-dsh/dist/swarm-tool-policy.js +0 -146
- package/plugins/kimi-dsh/dist/types.js +0 -1
- package/plugins/kimi-dsh/dist/util.js +0 -28
- package/plugins/kimi-dsh/dist/vendor/shell-quote/LICENSE +0 -24
- package/plugins/kimi-dsh/dist/vendor/shell-quote/index.js +0 -1
- package/plugins/kimi-dsh/dist/vendor/shell-quote/parse.js +0 -229
- package/plugins/kimi-dsh/dist/vendor/smol-toml/LICENSE +0 -24
- package/plugins/kimi-dsh/dist/vendor/smol-toml/date.js +0 -156
- package/plugins/kimi-dsh/dist/vendor/smol-toml/error.js +0 -67
- package/plugins/kimi-dsh/dist/vendor/smol-toml/extract.js +0 -293
- package/plugins/kimi-dsh/dist/vendor/smol-toml/parse.js +0 -164
- package/plugins/kimi-dsh/dist/vendor/smol-toml/primitive.js +0 -151
- package/plugins/kimi-dsh/dist/vendor/smol-toml/struct.js +0 -156
- package/plugins/kimi-dsh/dist/vendor/smol-toml/util.js +0 -57
- package/plugins/kimi-dsh/dist/version.js +0 -7
- package/plugins/kimi-dsh/package.json +0 -78
- package/plugins/kimi-dsh/scripts/companion.sh +0 -37
- package/plugins/kimi-dsh/scripts/review-gate-hook.sh +0 -32
- package/scripts/review-gate-hook.sh +0 -32
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
-
*
|
|
5
|
-
* Redistribution and use in source and binary forms, with or without
|
|
6
|
-
* modification, are permitted provided that the following conditions are met:
|
|
7
|
-
*
|
|
8
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
-
* list of conditions and the following disclaimer.
|
|
10
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
-
* this list of conditions and the following disclaimer in the
|
|
12
|
-
* documentation and/or other materials provided with the distribution.
|
|
13
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
14
|
-
* may be used to endorse or promote products derived from this software without
|
|
15
|
-
* specific prior written permission.
|
|
16
|
-
*
|
|
17
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
21
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
-
*/
|
|
28
|
-
import { parseKey } from './struct.js';
|
|
29
|
-
import { extractValue } from './extract.js';
|
|
30
|
-
import { skipVoid } from './util.js';
|
|
31
|
-
import { TomlError } from './error.js';
|
|
32
|
-
function peekTable(ctx, key, table, meta, type) {
|
|
33
|
-
let t = table;
|
|
34
|
-
let m = meta;
|
|
35
|
-
let k;
|
|
36
|
-
let hasOwn = false;
|
|
37
|
-
let state;
|
|
38
|
-
for (let i = 0; i < key.length; i++) {
|
|
39
|
-
if (i) {
|
|
40
|
-
t = hasOwn ? t[k] : (t[k] = Object.create(null));
|
|
41
|
-
m = (state = m[k]).c;
|
|
42
|
-
if (type === 0 /* Type.DOTTED */ && (state.t === 1 /* Type.EXPLICIT */ || state.t === 2 /* Type.ARRAY */)) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
if (state.t === 2 /* Type.ARRAY */) {
|
|
46
|
-
let l = t.length - 1;
|
|
47
|
-
t = t[l];
|
|
48
|
-
m = m[l].c;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
k = key[i];
|
|
52
|
-
if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 /* Type.DOTTED */ && m[k]?.d) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
if (!hasOwn) {
|
|
56
|
-
let unsafe = k === '__proto__';
|
|
57
|
-
if (ctx.uk && (unsafe || k === 'constructor'))
|
|
58
|
-
return false;
|
|
59
|
-
if (unsafe) {
|
|
60
|
-
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
61
|
-
Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
|
|
62
|
-
}
|
|
63
|
-
m[k] = {
|
|
64
|
-
t: i < key.length - 1 && type === 2 /* Type.ARRAY */
|
|
65
|
-
? 3 /* Type.ARRAY_DOTTED */ : type,
|
|
66
|
-
d: false,
|
|
67
|
-
i: 0,
|
|
68
|
-
c: Object.create(null),
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
state = m[k];
|
|
73
|
-
if (state.t !== type && !(type === 1 /* Type.EXPLICIT */ && state.t === 3 /* Type.ARRAY_DOTTED */)) {
|
|
74
|
-
// Bad key type!
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
if (type === 2 /* Type.ARRAY */) {
|
|
78
|
-
if (!state.d) {
|
|
79
|
-
state.d = true;
|
|
80
|
-
t[k] = [];
|
|
81
|
-
}
|
|
82
|
-
t[k].push(t = Object.create(null));
|
|
83
|
-
state.c[state.i++] = (state = { t: 1 /* Type.EXPLICIT */, d: false, i: 0, c: Object.create(null) });
|
|
84
|
-
}
|
|
85
|
-
if (state.d) {
|
|
86
|
-
// Redefining a table!
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
state.d = true;
|
|
90
|
-
if (type === 1 /* Type.EXPLICIT */) {
|
|
91
|
-
t = hasOwn ? t[k] : (t[k] = Object.create(null));
|
|
92
|
-
}
|
|
93
|
-
else if (type === 0 /* Type.DOTTED */ && hasOwn) {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
return [k, t, state.c];
|
|
97
|
-
}
|
|
98
|
-
function validateTablePeek(ctx, peek, ptr) {
|
|
99
|
-
if (peek === null || ctx.uk === 2)
|
|
100
|
-
TomlError.x(peek === null
|
|
101
|
-
? 'trying to redefine an already defined table or value'
|
|
102
|
-
: 'document contains an unsafe property', ctx, ptr);
|
|
103
|
-
}
|
|
104
|
-
export function parse(toml, options = {}) {
|
|
105
|
-
let ctx = {
|
|
106
|
-
s: toml,
|
|
107
|
-
p: 0,
|
|
108
|
-
d: options.maxDepth ?? 1000,
|
|
109
|
-
bi: options.integersAsBigInt ?? false,
|
|
110
|
-
ld: options.useLegacyDate ?? true,
|
|
111
|
-
uk: options.unsafeKeyBehaviour === 'throw' ? 2 : options.unsafeKeyBehaviour === 'drop' ? 1 : 0,
|
|
112
|
-
};
|
|
113
|
-
let res = Object.create(null);
|
|
114
|
-
let meta = Object.create(null);
|
|
115
|
-
let tmp;
|
|
116
|
-
let skipping = false;
|
|
117
|
-
let tbl = res;
|
|
118
|
-
let m = meta;
|
|
119
|
-
// BOM is allowed, skip.
|
|
120
|
-
// JS is UTF-16, so we have to check for the UTF-16 BOM instead of the UTF-8 BOM sequence!
|
|
121
|
-
if (toml.charCodeAt(0) === 0xfeff)
|
|
122
|
-
ctx.p++;
|
|
123
|
-
skipVoid(ctx);
|
|
124
|
-
while (ctx.p < toml.length) {
|
|
125
|
-
if (toml.charCodeAt(ctx.p) === 0x5b /* [ */) {
|
|
126
|
-
let isTableArray = toml.charCodeAt(++ctx.p) === 0x5b; /* [ */
|
|
127
|
-
tmp = ctx.p += +isTableArray;
|
|
128
|
-
skipping = false;
|
|
129
|
-
let k = parseKey(ctx, 0x5d /* ] */);
|
|
130
|
-
if (isTableArray) {
|
|
131
|
-
if (toml.charCodeAt(ctx.p) !== 0x5d /* ] */) {
|
|
132
|
-
TomlError.x('expected end of table array declaration', ctx);
|
|
133
|
-
}
|
|
134
|
-
ctx.p++;
|
|
135
|
-
}
|
|
136
|
-
let p = peekTable(ctx, k, res, meta, isTableArray ? 2 /* Type.ARRAY */ : 1 /* Type.EXPLICIT */);
|
|
137
|
-
if (!p) {
|
|
138
|
-
validateTablePeek(ctx, p, tmp);
|
|
139
|
-
skipping = true;
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
m = p[2];
|
|
143
|
-
tbl = p[1];
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
tmp = ctx.p;
|
|
148
|
-
let k = parseKey(ctx);
|
|
149
|
-
let p = peekTable(ctx, k, tbl, m, 0 /* Type.DOTTED */);
|
|
150
|
-
if (!p && !skipping)
|
|
151
|
-
validateTablePeek(ctx, p, tmp);
|
|
152
|
-
skipVoid(ctx, true, true);
|
|
153
|
-
let v = extractValue(ctx, void 0);
|
|
154
|
-
if (p && !skipping)
|
|
155
|
-
p[1][p[0]] = v;
|
|
156
|
-
}
|
|
157
|
-
skipVoid(ctx, true);
|
|
158
|
-
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 0xa /* \n */ && (tmp !== 0xd /* \r */ || toml.charCodeAt(ctx.p + 1) !== 0xa /* \n */)) {
|
|
159
|
-
TomlError.x('each key-value declaration must be followed by an end-of-line', ctx);
|
|
160
|
-
}
|
|
161
|
-
skipVoid(ctx);
|
|
162
|
-
}
|
|
163
|
-
return res;
|
|
164
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
-
*
|
|
5
|
-
* Redistribution and use in source and binary forms, with or without
|
|
6
|
-
* modification, are permitted provided that the following conditions are met:
|
|
7
|
-
*
|
|
8
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
-
* list of conditions and the following disclaimer.
|
|
10
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
-
* this list of conditions and the following disclaimer in the
|
|
12
|
-
* documentation and/or other materials provided with the distribution.
|
|
13
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
14
|
-
* may be used to endorse or promote products derived from this software without
|
|
15
|
-
* specific prior written permission.
|
|
16
|
-
*
|
|
17
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
21
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
-
*/
|
|
28
|
-
import { TomlError } from './error.js';
|
|
29
|
-
/** @internal */
|
|
30
|
-
export function parseString(ctx) {
|
|
31
|
-
let startPtr = ctx.p;
|
|
32
|
-
let c = ctx.s.charCodeAt(ctx.p++);
|
|
33
|
-
let first = c;
|
|
34
|
-
let isLiteral = c === 0x27; /* ' */
|
|
35
|
-
let isMultiline = c === ctx.s.charCodeAt(ctx.p) && c === ctx.s.charCodeAt(ctx.p + 1);
|
|
36
|
-
if (isMultiline) {
|
|
37
|
-
// Trim initial newline
|
|
38
|
-
if ((c = ctx.s.charCodeAt(ctx.p += 2)) === 0xa /* \n */)
|
|
39
|
-
ctx.p++;
|
|
40
|
-
else if (c === 0xd /* \r */ && ctx.s.charCodeAt(ctx.p + 1) === 0xa /* \n */)
|
|
41
|
-
ctx.p += 2;
|
|
42
|
-
}
|
|
43
|
-
// For the record: it is not worth it to use a fast-path for literal strings using `indexOf`.
|
|
44
|
-
// Doing a char-by-char iteration ends up dispatching less instructions, for the same wall-clock runtime.
|
|
45
|
-
let parsed = '';
|
|
46
|
-
let sliceStart = ctx.p;
|
|
47
|
-
// states:
|
|
48
|
-
// 0 - decoding
|
|
49
|
-
// 1 - decoding escape
|
|
50
|
-
// 2 - whitespace escape (no newline encountered yet, must fail on non-whitespace)
|
|
51
|
-
// 3 - whitespace escape (newline encountered, allowed to transition back to normal decode)
|
|
52
|
-
let state = 0;
|
|
53
|
-
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
54
|
-
c = ctx.s.charCodeAt(ctx.p);
|
|
55
|
-
// Deal with newlines first, since that simplifies control character checking and handling across all states
|
|
56
|
-
if (isMultiline && (c === 0xa /* \n */ || (c === 0xd /* \r */ && ctx.s.charCodeAt(ctx.p + 1) === 0xa /* \n */))) {
|
|
57
|
-
state = state && 3;
|
|
58
|
-
}
|
|
59
|
-
// Control characters are banned in TOML, so we throw an error if we encounter them
|
|
60
|
-
else if ((c < 0x20 && c !== 0x9 /* \t */) || c === 0x7f) {
|
|
61
|
-
TomlError.x('control characters are not allowed in strings', ctx);
|
|
62
|
-
}
|
|
63
|
-
// The string might terminate while we're parsing through a newline escape.
|
|
64
|
-
// It must have encountered a newline; otherwise, it'll simply fail in another branch.
|
|
65
|
-
else if ((!state || state === 3) && c === first && (!isMultiline || (ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first))) {
|
|
66
|
-
if (isMultiline) {
|
|
67
|
-
// If the string ends with 4-5 quotes, then the first 1-2 are part of the string
|
|
68
|
-
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
69
|
-
ctx.p++;
|
|
70
|
-
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
71
|
-
ctx.p++;
|
|
72
|
-
}
|
|
73
|
-
// If we're in a newline escape still, then there's nothing to add.
|
|
74
|
-
if (!state) {
|
|
75
|
-
// Avoid a useless concat operation if the string can be used as-is.
|
|
76
|
-
let s = ctx.s.slice(sliceStart, ctx.p);
|
|
77
|
-
parsed = parsed ? parsed + s : s;
|
|
78
|
-
}
|
|
79
|
-
ctx.p += isMultiline ? 3 : 1;
|
|
80
|
-
return parsed;
|
|
81
|
-
}
|
|
82
|
-
// Baseline state; keep moving forward unless an escape sequence starts
|
|
83
|
-
else if (!state) {
|
|
84
|
-
if (!isLiteral && c === 0x5c /* \ */) {
|
|
85
|
-
parsed += ctx.s.slice(sliceStart, (sliceStart = ctx.p));
|
|
86
|
-
state = 1;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
else if (state === 1) {
|
|
90
|
-
if (c === 0x78 /* x */ || c === 0x75 /* u */ || c === 0x55 /* U */) { // Unicode escape
|
|
91
|
-
let errPtr = ctx.p++ - 1;
|
|
92
|
-
let value = 0;
|
|
93
|
-
let len = c === 0x78 /* x */ ? 2 : c === 0x75 /* u */ ? 4 : 8;
|
|
94
|
-
for (let j = 0; j < len; j++, ctx.p++) {
|
|
95
|
-
let hex = ctx.s.charCodeAt(ctx.p);
|
|
96
|
-
let digit =
|
|
97
|
-
/* 0-9 */ hex >= 0x30 && hex <= 0x39 ? hex - 0x30 :
|
|
98
|
-
/* A-F */ hex >= 0x41 && hex <= 0x46 ? hex - 0x41 + 10 :
|
|
99
|
-
/* a-f */ hex >= 0x61 && hex <= 0x66 ? hex - 0x61 + 10 : -1;
|
|
100
|
-
if (digit < 0)
|
|
101
|
-
TomlError.x('invalid non-hex character in unicode escape', ctx);
|
|
102
|
-
value = (value << 4) | digit;
|
|
103
|
-
}
|
|
104
|
-
// Because JS does bitwise on signed 32bit integers, all 0xfzzzzzzz values are actually seen as negative
|
|
105
|
-
if (value < 0 || value > 0x10ffff || (value >= 0xd800 && value <= 0xdfff)) {
|
|
106
|
-
TomlError.x('invalid unicode escape', ctx, errPtr);
|
|
107
|
-
}
|
|
108
|
-
parsed += String.fromCodePoint(value);
|
|
109
|
-
sliceStart = ctx.p--;
|
|
110
|
-
state = 0;
|
|
111
|
-
}
|
|
112
|
-
// Newline escape sequence. We only need to care about spaces and tabs; newlines are dealt with earlier
|
|
113
|
-
else if (isMultiline && (c === 0x20 || c === 0x9 /* \t */)) {
|
|
114
|
-
state = 2;
|
|
115
|
-
}
|
|
116
|
-
// Basic escape sequence
|
|
117
|
-
else {
|
|
118
|
-
if (c === 0x62 /* b */)
|
|
119
|
-
parsed += '\b';
|
|
120
|
-
else if (c === 0x74 /* t */)
|
|
121
|
-
parsed += '\t';
|
|
122
|
-
else if (c === 0x6e /* n */)
|
|
123
|
-
parsed += '\n';
|
|
124
|
-
else if (c === 0x66 /* f */)
|
|
125
|
-
parsed += '\f';
|
|
126
|
-
else if (c === 0x72 /* r */)
|
|
127
|
-
parsed += '\r';
|
|
128
|
-
else if (c === 0x65 /* e */)
|
|
129
|
-
parsed += '\x1b';
|
|
130
|
-
else if (c === 0x22 /* " */)
|
|
131
|
-
parsed += '"';
|
|
132
|
-
else if (c === 0x5c /* \ */)
|
|
133
|
-
parsed += '\\';
|
|
134
|
-
else
|
|
135
|
-
TomlError.x('unrecognised escape sequence', ctx);
|
|
136
|
-
sliceStart = ctx.p + 1;
|
|
137
|
-
state = 0;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
// Newline escape continuation: keep moving forward until the first non-whitespace char
|
|
141
|
-
else if (c !== 0x20 && c !== 0x9 /* \t */) {
|
|
142
|
-
if (state === 2)
|
|
143
|
-
TomlError.x('invalid escape: only line-ending whitespace may be escaped', ctx, sliceStart);
|
|
144
|
-
// State cannot be zero, or we'd have branched earlier already.
|
|
145
|
-
// If it's a backslash, immediately transition to the escape state so it can be processed.
|
|
146
|
-
state = !isLiteral && c === 0x5c /* \ */ ? 1 : 0;
|
|
147
|
-
sliceStart = ctx.p;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
TomlError.x('unfinished string', ctx, startPtr);
|
|
151
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
-
*
|
|
5
|
-
* Redistribution and use in source and binary forms, with or without
|
|
6
|
-
* modification, are permitted provided that the following conditions are met:
|
|
7
|
-
*
|
|
8
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
-
* list of conditions and the following disclaimer.
|
|
10
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
-
* this list of conditions and the following disclaimer in the
|
|
12
|
-
* documentation and/or other materials provided with the distribution.
|
|
13
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
14
|
-
* may be used to endorse or promote products derived from this software without
|
|
15
|
-
* specific prior written permission.
|
|
16
|
-
*
|
|
17
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
21
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
-
*/
|
|
28
|
-
import { parseString } from './primitive.js';
|
|
29
|
-
import { extractValue } from './extract.js';
|
|
30
|
-
import { skipVoid } from './util.js';
|
|
31
|
-
import { TomlError } from './error.js';
|
|
32
|
-
/** @internal */
|
|
33
|
-
export function parseKey(ctx, end = 0x3d /* = */) {
|
|
34
|
-
// States:
|
|
35
|
-
// 0: before first char
|
|
36
|
-
// 1: parsing bare key
|
|
37
|
-
// 2: after key component
|
|
38
|
-
let startPtr;
|
|
39
|
-
let state = 0;
|
|
40
|
-
let parsed = [];
|
|
41
|
-
let sliceStart;
|
|
42
|
-
let c = ctx.s.charCodeAt(startPtr = ctx.p);
|
|
43
|
-
do {
|
|
44
|
-
// End of key
|
|
45
|
-
if (c === end) {
|
|
46
|
-
if (!state)
|
|
47
|
-
TomlError.x('unexpected end of key', ctx);
|
|
48
|
-
if (state === 1)
|
|
49
|
-
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
50
|
-
return ctx.p++, parsed;
|
|
51
|
-
}
|
|
52
|
-
// Dotted key separator
|
|
53
|
-
else if (c === 0x2e /* . */) {
|
|
54
|
-
if (!state)
|
|
55
|
-
TomlError.x('illegal empty bare key', ctx);
|
|
56
|
-
if (state === 1)
|
|
57
|
-
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
58
|
-
state = 0;
|
|
59
|
-
}
|
|
60
|
-
// Quoted key
|
|
61
|
-
else if (!state && (c === 0x22 /* " */ || c === 0x27 /* ' */)) {
|
|
62
|
-
if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
|
|
63
|
-
TomlError.x('illegal quoted key: multiline strings are not allowed', ctx);
|
|
64
|
-
parsed.push(parseString(ctx));
|
|
65
|
-
state = 2;
|
|
66
|
-
ctx.p--;
|
|
67
|
-
}
|
|
68
|
-
// Whitespace; no-op in state 0 and 2, end of bare key in state 1
|
|
69
|
-
else if (c === 0x20 || c === 0x9 /* \t */) {
|
|
70
|
-
if (state === 1) {
|
|
71
|
-
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
72
|
-
state = 2;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
// If state is post-key, no character is allowed; otherwise ensure it's a bare-key component
|
|
76
|
-
else if (state === 2 || (c < 0x30 && c !== 0x2d /* - */) || (c > 0x39 && c < 0x41) || (c > 0x5a && c < 0x61 && c !== 0x5f /* _ */) || c > 0x7a) {
|
|
77
|
-
TomlError.x('illegal character in key', ctx);
|
|
78
|
-
}
|
|
79
|
-
// Illegal character
|
|
80
|
-
else if (!state) {
|
|
81
|
-
state = 1;
|
|
82
|
-
sliceStart = ctx.p;
|
|
83
|
-
}
|
|
84
|
-
} while (c = ctx.s.charCodeAt(++ctx.p));
|
|
85
|
-
TomlError.x('incomplete key-value: cannot find end of key', ctx, startPtr);
|
|
86
|
-
}
|
|
87
|
-
/** @internal */
|
|
88
|
-
export function parseInlineTable(ctx) {
|
|
89
|
-
let startPtr = ctx.p++;
|
|
90
|
-
let res = Object.create(null);
|
|
91
|
-
let seen = new Set();
|
|
92
|
-
let c;
|
|
93
|
-
while (ctx.p < ctx.s.length) {
|
|
94
|
-
skipVoid(ctx);
|
|
95
|
-
if ((c = ctx.s.charCodeAt(ctx.p)) === 0x7d /* } */) {
|
|
96
|
-
ctx.p++;
|
|
97
|
-
return res;
|
|
98
|
-
}
|
|
99
|
-
let k;
|
|
100
|
-
let t = res;
|
|
101
|
-
let hasOwn = false;
|
|
102
|
-
let errPtr = ctx.p;
|
|
103
|
-
let key = parseKey(ctx);
|
|
104
|
-
for (let i = 0; i < key.length; i++) {
|
|
105
|
-
if (i)
|
|
106
|
-
t = hasOwn ? t[k] : (t[k] = Object.create(null));
|
|
107
|
-
k = key[i];
|
|
108
|
-
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== 'object' || seen.has(t[k]))) {
|
|
109
|
-
TomlError.x('trying to redefine an already defined value', ctx, errPtr);
|
|
110
|
-
}
|
|
111
|
-
let unsafe = k === '__proto__';
|
|
112
|
-
if (ctx.uk && (unsafe || k === 'constructor')) {
|
|
113
|
-
t = ctx.uk !== 1 && TomlError.x('document contains an unsafe property', ctx, errPtr);
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
if (!hasOwn && unsafe) {
|
|
117
|
-
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (hasOwn) {
|
|
121
|
-
TomlError.x('trying to redefine an already defined value', ctx, errPtr);
|
|
122
|
-
}
|
|
123
|
-
skipVoid(ctx, true, true);
|
|
124
|
-
let value = extractValue(ctx, 0x7d /* } */);
|
|
125
|
-
if (t && typeof (t[k] = value) === 'object')
|
|
126
|
-
seen.add(value);
|
|
127
|
-
skipVoid(ctx);
|
|
128
|
-
if ((c = ctx.s.charCodeAt(ctx.p++)) === 0x7d /* } */) {
|
|
129
|
-
return res;
|
|
130
|
-
}
|
|
131
|
-
if (c !== 0x2c /* , */)
|
|
132
|
-
TomlError.x('expected comma or end of structure', ctx, ctx.p - 1);
|
|
133
|
-
}
|
|
134
|
-
TomlError.x('unfinished table', ctx, startPtr);
|
|
135
|
-
}
|
|
136
|
-
/** @internal */
|
|
137
|
-
export function parseArray(ctx) {
|
|
138
|
-
let startPtr = ctx.p++;
|
|
139
|
-
let res = [];
|
|
140
|
-
let c;
|
|
141
|
-
while (ctx.p < ctx.s.length) {
|
|
142
|
-
skipVoid(ctx);
|
|
143
|
-
if ((c = ctx.s.charCodeAt(ctx.p)) === 0x5d /* ] */) {
|
|
144
|
-
ctx.p++;
|
|
145
|
-
return res;
|
|
146
|
-
}
|
|
147
|
-
res.push(extractValue(ctx, 0x5d /* ] */));
|
|
148
|
-
skipVoid(ctx);
|
|
149
|
-
if ((c = ctx.s.charCodeAt(ctx.p++)) === 0x5d /* ] */) {
|
|
150
|
-
return res;
|
|
151
|
-
}
|
|
152
|
-
if (c !== 0x2c /* , */)
|
|
153
|
-
TomlError.x('expected comma or end of structure', ctx, ctx.p - 1);
|
|
154
|
-
}
|
|
155
|
-
TomlError.x('unfinished array', ctx, startPtr);
|
|
156
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
-
*
|
|
5
|
-
* Redistribution and use in source and binary forms, with or without
|
|
6
|
-
* modification, are permitted provided that the following conditions are met:
|
|
7
|
-
*
|
|
8
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
-
* list of conditions and the following disclaimer.
|
|
10
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
-
* this list of conditions and the following disclaimer in the
|
|
12
|
-
* documentation and/or other materials provided with the distribution.
|
|
13
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
14
|
-
* may be used to endorse or promote products derived from this software without
|
|
15
|
-
* specific prior written permission.
|
|
16
|
-
*
|
|
17
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
21
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
-
*/
|
|
28
|
-
import { TomlError } from './error.js';
|
|
29
|
-
/** @internal */
|
|
30
|
-
export function skipComment(ctx) {
|
|
31
|
-
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
32
|
-
let c = ctx.s.charCodeAt(ctx.p);
|
|
33
|
-
if (c === 0xa /* \n */)
|
|
34
|
-
break;
|
|
35
|
-
if (c === 0xd /* \r */ && ctx.s.charCodeAt(ctx.p + 1) === 0xa /* \n */) {
|
|
36
|
-
ctx.p++;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
if ((c < 0x20 && c !== 0x9 /* \t */) || c === 0x7f) {
|
|
40
|
-
TomlError.x('control characters are not allowed in comments', ctx);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/** @internal */
|
|
45
|
-
export function skipVoid(ctx, banNewLines, banComments) {
|
|
46
|
-
let c;
|
|
47
|
-
while (ctx.p < ctx.s.length) {
|
|
48
|
-
while (ctx.p < ctx.s.length && ((c = ctx.s.charCodeAt(ctx.p)) === 0x20 ||
|
|
49
|
-
c === 0x9 /* \t */ ||
|
|
50
|
-
(!banNewLines &&
|
|
51
|
-
(c === 0xa /* \n */ || (c === 0xd /* \r */ && ctx.s.charCodeAt(ctx.p + 1) === 0xa /* \n */)))))
|
|
52
|
-
ctx.p++;
|
|
53
|
-
if (banComments || c !== 0x23 /* # */)
|
|
54
|
-
break;
|
|
55
|
-
skipComment(ctx);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Single source of truth for the plugin version that the runtime reports
|
|
2
|
-
// in setup output and managed-block markers. Keep this in sync with
|
|
3
|
-
// package.json, .claude-plugin/plugin.json, .claude-plugin/marketplace.json,
|
|
4
|
-
// and AGENTS.md on every release. A future improvement would read this from
|
|
5
|
-
// package.json at build time, but that adds a build-step dependency we
|
|
6
|
-
// don't want yet.
|
|
7
|
-
export const KIMI_PLUGIN_CC_VERSION = "3.0.0";
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "kimi-plugin-cc",
|
|
3
|
-
"version": "3.0.0",
|
|
4
|
-
"description": "Kimi Code subagents for DeepSeek Harness: all seven ask, review, challenge, rescue, pursue, swarm, and swarm-write operations through the kimi-plugin-cc companion runtime.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/dsh/index.js",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./dist/dsh/index.js",
|
|
9
|
-
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
10
|
-
"./package.json": "./package.json"
|
|
11
|
-
},
|
|
12
|
-
"files": [
|
|
13
|
-
"cordis.patch.yml",
|
|
14
|
-
"dist/",
|
|
15
|
-
"scripts/",
|
|
16
|
-
"README.md",
|
|
17
|
-
"LICENSE"
|
|
18
|
-
],
|
|
19
|
-
"engines": {
|
|
20
|
-
"node": ">=24.9.0",
|
|
21
|
-
"dsh": ">=0.2.1-rc.5 <0.3.0"
|
|
22
|
-
},
|
|
23
|
-
"dsh": {
|
|
24
|
-
"bundle": {
|
|
25
|
-
"patch": "./cordis.patch.yml"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"peerDependencies": {
|
|
29
|
-
"@deepseek-ai/cordis": "~4.0.5",
|
|
30
|
-
"@deepseek-ai/dsh-commands": ">=0.2.1-rc.5 <0.3.0",
|
|
31
|
-
"@deepseek-ai/dsh-llm": ">=0.2.1-rc.5 <0.3.0",
|
|
32
|
-
"@deepseek-ai/dsh-session": ">=0.2.1-rc.5 <0.3.0",
|
|
33
|
-
"@deepseek-ai/dsh-subagent": ">=0.2.1-rc.5 <0.3.0",
|
|
34
|
-
"@deepseek-ai/dsh-subprocess": ">=0.2.1-rc.5 <0.3.0",
|
|
35
|
-
"@deepseek-ai/dsh-system-prompt": ">=0.2.1-rc.5 <0.3.0",
|
|
36
|
-
"@deepseek-ai/dsh-working-directory": ">=0.2.1-rc.5 <0.3.0",
|
|
37
|
-
"@deepseek-ai/dsh-tool-subagent": ">=0.2.1-rc.5 <0.3.0"
|
|
38
|
-
},
|
|
39
|
-
"peerDependenciesMeta": {
|
|
40
|
-
"@deepseek-ai/cordis": {
|
|
41
|
-
"optional": true
|
|
42
|
-
},
|
|
43
|
-
"@deepseek-ai/dsh-commands": {
|
|
44
|
-
"optional": true
|
|
45
|
-
},
|
|
46
|
-
"@deepseek-ai/dsh-llm": {
|
|
47
|
-
"optional": true
|
|
48
|
-
},
|
|
49
|
-
"@deepseek-ai/dsh-session": {
|
|
50
|
-
"optional": true
|
|
51
|
-
},
|
|
52
|
-
"@deepseek-ai/dsh-subagent": {
|
|
53
|
-
"optional": true
|
|
54
|
-
},
|
|
55
|
-
"@deepseek-ai/dsh-subprocess": {
|
|
56
|
-
"optional": true
|
|
57
|
-
},
|
|
58
|
-
"@deepseek-ai/dsh-system-prompt": {
|
|
59
|
-
"optional": true
|
|
60
|
-
},
|
|
61
|
-
"@deepseek-ai/dsh-working-directory": {
|
|
62
|
-
"optional": true
|
|
63
|
-
},
|
|
64
|
-
"@deepseek-ai/dsh-tool-subagent": {
|
|
65
|
-
"optional": true
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
"dependencies": {
|
|
69
|
-
"@deepseek-ai/dsh-brand": ">=0.2.1-rc.5 <0.3.0",
|
|
70
|
-
"@deepseek-ai/schemastery": "~3.18.5"
|
|
71
|
-
},
|
|
72
|
-
"license": "Apache-2.0",
|
|
73
|
-
"repository": {
|
|
74
|
-
"type": "git",
|
|
75
|
-
"url": "git+https://github.com/linxule/kimi-plugin-cc.git",
|
|
76
|
-
"directory": "plugins/kimi-dsh"
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
# Entry point for slash commands. Launches the compiled Node runtime from the plugin root so
|
|
5
|
-
# that runtime dependencies resolve against the plugin's node_modules, while preserving the
|
|
6
|
-
# user's working directory via KIMI_PLUGIN_CC_WORKSPACE_CWD.
|
|
7
|
-
#
|
|
8
|
-
# Required env: CLAUDE_PLUGIN_ROOT (set by Claude Code when the plugin is installed).
|
|
9
|
-
# Codex plugin hosts may provide PLUGIN_ROOT/PLUGIN_DATA instead; accept those as aliases.
|
|
10
|
-
# When running from the repo checkout, both root env vars may be unset — default to the
|
|
11
|
-
# script's parent directory so `bun run` style local invocation still works.
|
|
12
|
-
|
|
13
|
-
: "${CLAUDE_PLUGIN_ROOT:=${PLUGIN_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}}"
|
|
14
|
-
export CLAUDE_PLUGIN_ROOT
|
|
15
|
-
export PLUGIN_ROOT="${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}"
|
|
16
|
-
# Data-root selection lives in the runtime so commands, workers, and Stop agree.
|
|
17
|
-
# Preserve shared variables verbatim: conflicting values must not be hidden.
|
|
18
|
-
export KIMI_PLUGIN_CC_SHELL_LAUNCH=1
|
|
19
|
-
export KIMI_PLUGIN_CC_WORKSPACE_CWD="${KIMI_PLUGIN_CC_WORKSPACE_CWD:-$PWD}"
|
|
20
|
-
|
|
21
|
-
NODE_BIN="${KIMI_PLUGIN_CC_NODE_BIN:-$(command -v node 2>/dev/null || true)}"
|
|
22
|
-
if [ -z "${NODE_BIN}" ]; then
|
|
23
|
-
echo "kimi-plugin-cc: unable to locate 'node'. Install Node >= 22.5 or set KIMI_PLUGIN_CC_NODE_BIN to an absolute path." >&2
|
|
24
|
-
exit 127
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
NODE_VERSION_OUT="$("${NODE_BIN}" --version 2>/dev/null || true)"
|
|
28
|
-
NODE_MAJOR="$(printf '%s\n' "${NODE_VERSION_OUT}" | sed -En 's/^v([0-9]+)\..*/\1/p')"
|
|
29
|
-
NODE_MINOR="$(printf '%s\n' "${NODE_VERSION_OUT}" | sed -En 's/^v[0-9]+\.([0-9]+)\..*/\1/p')"
|
|
30
|
-
if [ -z "${NODE_MAJOR}" ] || [ -z "${NODE_MINOR}" ] || [ "${NODE_MAJOR}" -lt 22 ] || \
|
|
31
|
-
{ [ "${NODE_MAJOR}" -eq 22 ] && [ "${NODE_MINOR}" -lt 5 ]; }; then
|
|
32
|
-
echo "kimi-plugin-cc requires Node >= 22.5.0 (node:sqlite is a built-in, introduced in 22.5). Found: ${NODE_VERSION_OUT:-unknown}. Upgrade Node or set KIMI_PLUGIN_CC_NODE_BIN to a qualifying binary." >&2
|
|
33
|
-
exit 127
|
|
34
|
-
fi
|
|
35
|
-
|
|
36
|
-
cd "${CLAUDE_PLUGIN_ROOT}"
|
|
37
|
-
exec "${NODE_BIN}" dist/companion.js "$@"
|