@digipair/skill-codex 0.99.1 → 0.99.2
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/index.cjs.js +16 -28
- package/index.esm.js +16 -28
- package/package.json +1 -1
- package/schema.fr.json +14 -1
- package/schema.json +9 -0
package/index.cjs.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var child_process = require('child_process');
|
|
6
6
|
var fs = require('fs');
|
|
7
|
-
var path = require('path');
|
|
8
7
|
|
|
9
8
|
function _interopNamespace(e) {
|
|
10
9
|
if (e && e.__esModule) return e;
|
|
@@ -23925,14 +23924,14 @@ function indent(str, spaces) {
|
|
|
23925
23924
|
var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
|
|
23926
23925
|
// match is required
|
|
23927
23926
|
if (!match) {
|
|
23928
|
-
return
|
|
23927
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
|
|
23929
23928
|
v: nextMatch1
|
|
23930
23929
|
};
|
|
23931
23930
|
}
|
|
23932
23931
|
var token = match.token, offset = match.offset;
|
|
23933
23932
|
i1 += offset;
|
|
23934
23933
|
if (token === " ") {
|
|
23935
|
-
return
|
|
23934
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
|
|
23936
23935
|
}
|
|
23937
23936
|
tokens1 = _to_consumable_array$1(tokens1).concat([
|
|
23938
23937
|
token
|
|
@@ -23951,7 +23950,7 @@ function indent(str, spaces) {
|
|
|
23951
23950
|
if (contextKeys.some(function(el) {
|
|
23952
23951
|
return el.startsWith(name);
|
|
23953
23952
|
})) {
|
|
23954
|
-
return
|
|
23953
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
|
|
23955
23954
|
}
|
|
23956
23955
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23957
23956
|
return el === name;
|
|
@@ -23970,9 +23969,9 @@ function indent(str, spaces) {
|
|
|
23970
23969
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23971
23970
|
return el.startsWith(name);
|
|
23972
23971
|
})) {
|
|
23973
|
-
return
|
|
23972
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
|
|
23974
23973
|
}
|
|
23975
|
-
return
|
|
23974
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
|
|
23976
23975
|
v: nextMatch1
|
|
23977
23976
|
};
|
|
23978
23977
|
};
|
|
@@ -28008,31 +28007,15 @@ const preparePinsSettings = (settings, context)=>{
|
|
|
28008
28007
|
|
|
28009
28008
|
let CodexService = class CodexService {
|
|
28010
28009
|
/**
|
|
28011
|
-
* Find the local Codex CLI entrypoint installed in this repo.
|
|
28012
|
-
* Searches upwards from the current working directory for
|
|
28013
|
-
* `node_modules/@openai/codex/bin/codex.js`.
|
|
28014
|
-
*/ findCodexBin(startDir) {
|
|
28015
|
-
let dir = startDir;
|
|
28016
|
-
for(let i = 0; i < 6; i++){
|
|
28017
|
-
const candidate = path.join(dir, 'node_modules', '@openai', 'codex', 'bin', 'codex.js');
|
|
28018
|
-
if (fs.existsSync(candidate)) return candidate;
|
|
28019
|
-
const parent = path.dirname(dir);
|
|
28020
|
-
if (parent === dir) break;
|
|
28021
|
-
dir = parent;
|
|
28022
|
-
}
|
|
28023
|
-
// Fallback to a reasonable default relative to repo root
|
|
28024
|
-
return path.join(process.cwd(), '..', '..', 'node_modules', '@openai', 'codex', 'bin', 'codex.js');
|
|
28025
|
-
}
|
|
28026
|
-
/**
|
|
28027
28010
|
* Runs the local Codex CLI with the provided prompt and returns its stdout as a string.
|
|
28028
28011
|
* Requires either ChatGPT sign-in (codex login) or OPENAI_API_KEY in the environment.
|
|
28029
28012
|
*/ async runPrompt(params, _pinsSettingsList, context) {
|
|
28030
28013
|
var _child_stdout, _child_stderr;
|
|
28031
|
-
const { prompt, sandbox = 'read-only', cwd = process.cwd() + '/factory/digipairs', timeoutMs, onStdout = [], onAction = [] } = params;
|
|
28014
|
+
const { prompt, sandbox = 'read-only', cwd = process.cwd() + '/factory/digipairs', timeoutMs, onStdout = [], onAction = [], debug = false } = params;
|
|
28032
28015
|
if (!prompt || !prompt.trim()) {
|
|
28033
28016
|
throw new Error('Prompt must be a non-empty string');
|
|
28034
28017
|
}
|
|
28035
|
-
const codexJs =
|
|
28018
|
+
const codexJs = require.resolve('@openai/codex/bin/codex.js');
|
|
28036
28019
|
if (!fs.existsSync(codexJs)) {
|
|
28037
28020
|
throw new Error(`Codex CLI not found. Ensure @openai/codex is installed. Looked for: ${codexJs}`);
|
|
28038
28021
|
}
|
|
@@ -28065,13 +28048,18 @@ let CodexService = class CodexService {
|
|
|
28065
28048
|
const onData = (chunk)=>{
|
|
28066
28049
|
const s = chunk.toString();
|
|
28067
28050
|
stdout += s;
|
|
28068
|
-
if (
|
|
28069
|
-
|
|
28070
|
-
}
|
|
28051
|
+
if (debug) {
|
|
28052
|
+
process.stdout.write(s);
|
|
28053
|
+
}
|
|
28054
|
+
if (onStdout) {
|
|
28055
|
+
executePinsList(onStdout, _extends({
|
|
28056
|
+
chunk: s
|
|
28057
|
+
}, context), `${context.__PATH__}.onStdout`);
|
|
28058
|
+
}
|
|
28071
28059
|
if (regexNewLine.test(s)) {
|
|
28072
28060
|
if (listening && !line.startsWith('{')) executePinsList(onAction, _extends({
|
|
28073
28061
|
action: line.trim()
|
|
28074
|
-
}, context));
|
|
28062
|
+
}, context), `${context.__PATH__}.onAction`);
|
|
28075
28063
|
listening = false;
|
|
28076
28064
|
}
|
|
28077
28065
|
if (regexCodex.test(s)) {
|
package/index.esm.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { spawn } from 'child_process';
|
|
2
2
|
import { existsSync } from 'fs';
|
|
3
|
-
import { join, dirname } from 'path';
|
|
4
3
|
|
|
5
4
|
function _extends() {
|
|
6
5
|
_extends = Object.assign || function assign(target) {
|
|
@@ -23903,14 +23902,14 @@ function indent(str, spaces) {
|
|
|
23903
23902
|
var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
|
|
23904
23903
|
// match is required
|
|
23905
23904
|
if (!match) {
|
|
23906
|
-
return nextMatch = nextMatch1,
|
|
23905
|
+
return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
|
|
23907
23906
|
v: nextMatch1
|
|
23908
23907
|
};
|
|
23909
23908
|
}
|
|
23910
23909
|
var token = match.token, offset = match.offset;
|
|
23911
23910
|
i1 += offset;
|
|
23912
23911
|
if (token === " ") {
|
|
23913
|
-
return nextMatch = nextMatch1,
|
|
23912
|
+
return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
|
|
23914
23913
|
}
|
|
23915
23914
|
tokens1 = _to_consumable_array$1(tokens1).concat([
|
|
23916
23915
|
token
|
|
@@ -23929,7 +23928,7 @@ function indent(str, spaces) {
|
|
|
23929
23928
|
if (contextKeys.some(function(el) {
|
|
23930
23929
|
return el.startsWith(name);
|
|
23931
23930
|
})) {
|
|
23932
|
-
return nextMatch = nextMatch1,
|
|
23931
|
+
return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
|
|
23933
23932
|
}
|
|
23934
23933
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23935
23934
|
return el === name;
|
|
@@ -23948,9 +23947,9 @@ function indent(str, spaces) {
|
|
|
23948
23947
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23949
23948
|
return el.startsWith(name);
|
|
23950
23949
|
})) {
|
|
23951
|
-
return nextMatch = nextMatch1,
|
|
23950
|
+
return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
|
|
23952
23951
|
}
|
|
23953
|
-
return nextMatch = nextMatch1,
|
|
23952
|
+
return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
|
|
23954
23953
|
v: nextMatch1
|
|
23955
23954
|
};
|
|
23956
23955
|
};
|
|
@@ -27986,31 +27985,15 @@ const preparePinsSettings = (settings, context)=>{
|
|
|
27986
27985
|
|
|
27987
27986
|
let CodexService = class CodexService {
|
|
27988
27987
|
/**
|
|
27989
|
-
* Find the local Codex CLI entrypoint installed in this repo.
|
|
27990
|
-
* Searches upwards from the current working directory for
|
|
27991
|
-
* `node_modules/@openai/codex/bin/codex.js`.
|
|
27992
|
-
*/ findCodexBin(startDir) {
|
|
27993
|
-
let dir = startDir;
|
|
27994
|
-
for(let i = 0; i < 6; i++){
|
|
27995
|
-
const candidate = join(dir, 'node_modules', '@openai', 'codex', 'bin', 'codex.js');
|
|
27996
|
-
if (existsSync(candidate)) return candidate;
|
|
27997
|
-
const parent = dirname(dir);
|
|
27998
|
-
if (parent === dir) break;
|
|
27999
|
-
dir = parent;
|
|
28000
|
-
}
|
|
28001
|
-
// Fallback to a reasonable default relative to repo root
|
|
28002
|
-
return join(process.cwd(), '..', '..', 'node_modules', '@openai', 'codex', 'bin', 'codex.js');
|
|
28003
|
-
}
|
|
28004
|
-
/**
|
|
28005
27988
|
* Runs the local Codex CLI with the provided prompt and returns its stdout as a string.
|
|
28006
27989
|
* Requires either ChatGPT sign-in (codex login) or OPENAI_API_KEY in the environment.
|
|
28007
27990
|
*/ async runPrompt(params, _pinsSettingsList, context) {
|
|
28008
27991
|
var _child_stdout, _child_stderr;
|
|
28009
|
-
const { prompt, sandbox = 'read-only', cwd = process.cwd() + '/factory/digipairs', timeoutMs, onStdout = [], onAction = [] } = params;
|
|
27992
|
+
const { prompt, sandbox = 'read-only', cwd = process.cwd() + '/factory/digipairs', timeoutMs, onStdout = [], onAction = [], debug = false } = params;
|
|
28010
27993
|
if (!prompt || !prompt.trim()) {
|
|
28011
27994
|
throw new Error('Prompt must be a non-empty string');
|
|
28012
27995
|
}
|
|
28013
|
-
const codexJs =
|
|
27996
|
+
const codexJs = require.resolve('@openai/codex/bin/codex.js');
|
|
28014
27997
|
if (!existsSync(codexJs)) {
|
|
28015
27998
|
throw new Error(`Codex CLI not found. Ensure @openai/codex is installed. Looked for: ${codexJs}`);
|
|
28016
27999
|
}
|
|
@@ -28043,13 +28026,18 @@ let CodexService = class CodexService {
|
|
|
28043
28026
|
const onData = (chunk)=>{
|
|
28044
28027
|
const s = chunk.toString();
|
|
28045
28028
|
stdout += s;
|
|
28046
|
-
if (
|
|
28047
|
-
|
|
28048
|
-
}
|
|
28029
|
+
if (debug) {
|
|
28030
|
+
process.stdout.write(s);
|
|
28031
|
+
}
|
|
28032
|
+
if (onStdout) {
|
|
28033
|
+
executePinsList(onStdout, _extends({
|
|
28034
|
+
chunk: s
|
|
28035
|
+
}, context), `${context.__PATH__}.onStdout`);
|
|
28036
|
+
}
|
|
28049
28037
|
if (regexNewLine.test(s)) {
|
|
28050
28038
|
if (listening && !line.startsWith('{')) executePinsList(onAction, _extends({
|
|
28051
28039
|
action: line.trim()
|
|
28052
|
-
}, context));
|
|
28040
|
+
}, context), `${context.__PATH__}.onAction`);
|
|
28053
28041
|
listening = false;
|
|
28054
28042
|
}
|
|
28055
28043
|
if (regexCodex.test(s)) {
|
package/package.json
CHANGED
package/schema.fr.json
CHANGED
|
@@ -32,7 +32,11 @@
|
|
|
32
32
|
"description": "Mode sandbox pour l'exécution de Codex (par défaut 'read-only')",
|
|
33
33
|
"schema": {
|
|
34
34
|
"type": "string",
|
|
35
|
-
"enum": [
|
|
35
|
+
"enum": [
|
|
36
|
+
"read-only",
|
|
37
|
+
"workspace-write",
|
|
38
|
+
"danger-full-access"
|
|
39
|
+
]
|
|
36
40
|
}
|
|
37
41
|
},
|
|
38
42
|
{
|
|
@@ -53,6 +57,15 @@
|
|
|
53
57
|
"type": "number"
|
|
54
58
|
}
|
|
55
59
|
},
|
|
60
|
+
{
|
|
61
|
+
"name": "debug",
|
|
62
|
+
"summary": "Mode débogage",
|
|
63
|
+
"required": false,
|
|
64
|
+
"description": "Active le mode débogage",
|
|
65
|
+
"schema": {
|
|
66
|
+
"type": "boolean"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
56
69
|
{
|
|
57
70
|
"name": "onStdout",
|
|
58
71
|
"summary": "Callback stdout",
|
package/schema.json
CHANGED
|
@@ -57,6 +57,15 @@
|
|
|
57
57
|
"type": "number"
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
|
+
{
|
|
61
|
+
"name": "debug",
|
|
62
|
+
"summary": "Debug mode",
|
|
63
|
+
"required": false,
|
|
64
|
+
"description": "Enables debug mode",
|
|
65
|
+
"schema": {
|
|
66
|
+
"type": "boolean"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
60
69
|
{
|
|
61
70
|
"name": "onStdout",
|
|
62
71
|
"summary": "On stdout",
|