@principles/codex-adapter 0.5.6 → 0.5.7
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.
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const CODEX_OWNER_STATEMENT_PREFIX = "PD\u8BB0\u5F55\u75DB\u82E6\uFF1A";
|
|
3
|
-
/** SPEC §6.1: reject instead of truncating the Owner's intent. */
|
|
4
|
-
export declare const MAX_OWNER_STATEMENT_CHARS = 500;
|
|
5
|
-
export type OwnerStatementPrefixParse = {
|
|
6
|
-
matched: false;
|
|
7
|
-
} | {
|
|
8
|
-
matched: true;
|
|
9
|
-
text: string | null;
|
|
10
|
-
reason?: 'statement_empty' | 'statement_too_long';
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Deterministic prefix parse of the CURRENT user prompt. `text === null` means
|
|
14
|
-
* the prefix matched but the remainder was empty/blank — an explicit request
|
|
15
|
-
* with no content is a bounded rejection, never a fabricated statement.
|
|
16
|
-
*/
|
|
17
|
-
export declare function parseOwnerStatementPrefix(prompt: unknown): OwnerStatementPrefixParse;
|
|
1
|
+
export { OWNER_STATEMENT_PREFIX as CODEX_OWNER_STATEMENT_PREFIX, MAX_OWNER_STATEMENT_CHARS, parseOwnerStatementPrefix, type OwnerStatementPrefixParse } from '@principles/host-runtime';
|
|
18
2
|
export type RecordOwnerStatementResult = {
|
|
19
3
|
status: 'received';
|
|
20
4
|
painId: string;
|
|
@@ -23,27 +23,7 @@ import { admitGovernanceSignals, ensureGovernanceDiagnosticianTask, promoteAdmit
|
|
|
23
23
|
import { resolveCodexHome } from './codex-home.js';
|
|
24
24
|
import { validateCodexTranscriptPath } from './transcript-path.js';
|
|
25
25
|
import { extractFields } from './ingestion-fields.js';
|
|
26
|
-
|
|
27
|
-
export const CODEX_OWNER_STATEMENT_PREFIX = 'PD记录痛苦:';
|
|
28
|
-
/** SPEC §6.1: reject instead of truncating the Owner's intent. */
|
|
29
|
-
export const MAX_OWNER_STATEMENT_CHARS = 500;
|
|
30
|
-
/**
|
|
31
|
-
* Deterministic prefix parse of the CURRENT user prompt. `text === null` means
|
|
32
|
-
* the prefix matched but the remainder was empty/blank — an explicit request
|
|
33
|
-
* with no content is a bounded rejection, never a fabricated statement.
|
|
34
|
-
*/
|
|
35
|
-
export function parseOwnerStatementPrefix(prompt) {
|
|
36
|
-
if (typeof prompt !== 'string')
|
|
37
|
-
return { matched: false };
|
|
38
|
-
if (!prompt.startsWith(CODEX_OWNER_STATEMENT_PREFIX))
|
|
39
|
-
return { matched: false };
|
|
40
|
-
const remainder = prompt.slice(CODEX_OWNER_STATEMENT_PREFIX.length).trim();
|
|
41
|
-
if (remainder.length === 0)
|
|
42
|
-
return { matched: true, text: null, reason: 'statement_empty' };
|
|
43
|
-
if (remainder.length > MAX_OWNER_STATEMENT_CHARS)
|
|
44
|
-
return { matched: true, text: null, reason: 'statement_too_long' };
|
|
45
|
-
return { matched: true, text: remainder };
|
|
46
|
-
}
|
|
26
|
+
export { OWNER_STATEMENT_PREFIX as CODEX_OWNER_STATEMENT_PREFIX, MAX_OWNER_STATEMENT_CHARS, parseOwnerStatementPrefix } from '@principles/host-runtime';
|
|
47
27
|
/**
|
|
48
28
|
* Persist one explicit Owner statement. The consent-gated conversation
|
|
49
29
|
* ingestion flag does NOT gate this path (no conversation tables or transcript
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principles/codex-adapter",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7",
|
|
4
4
|
"description": "Codex CLI host adapter for Principles Disciple — implements HostAdapter interface for OpenAI Codex CLI's stdin/stdout JSON hook model (ADR-0020).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"lint": "eslint \"src/**/*.ts\""
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@principles/core": "^1.293.
|
|
37
|
-
"@principles/host-runtime": "^0.10.
|
|
36
|
+
"@principles/core": "^1.293.4",
|
|
37
|
+
"@principles/host-runtime": "^0.10.2",
|
|
38
38
|
"@principles/install-layout": "^0.4.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|