@hilbras/omninode 2.0.0-alpha.12 → 2.0.0-alpha.13
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/README.md +9 -1
- package/dist/cli/index.js +116 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +24 -2
- package/dist/index.js +52 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1995,6 +1995,26 @@ type PlannerConfigYaml = z.infer<typeof plannerConfigSchema>;
|
|
|
1995
1995
|
type ProjectConfigYaml = z.infer<typeof projectConfigSchema>;
|
|
1996
1996
|
type AppConfigYaml = z.infer<typeof appConfigSchema>;
|
|
1997
1997
|
|
|
1998
|
+
/**
|
|
1999
|
+
* Inline secret detection (roadmap §17, Secrets).
|
|
2000
|
+
*
|
|
2001
|
+
* OmniNode configuration must never contain literal credentials — only
|
|
2002
|
+
* environment-variable *references*. This scanner runs before the config is
|
|
2003
|
+
* parsed and reports anything that looks like an inline secret, so the file
|
|
2004
|
+
* is rejected before it can be committed or persisted.
|
|
2005
|
+
*/
|
|
2006
|
+
interface SecretFinding {
|
|
2007
|
+
/** 1-based line number in the source. */
|
|
2008
|
+
line: number;
|
|
2009
|
+
/** The offending key, e.g. `api_key`. */
|
|
2010
|
+
key: string;
|
|
2011
|
+
/** Redacted excerpt — never echoes the value. */
|
|
2012
|
+
excerpt: string;
|
|
2013
|
+
}
|
|
2014
|
+
declare function scanForInlineSecrets(source: string): SecretFinding[];
|
|
2015
|
+
/** Formats findings as an actionable configuration error message. */
|
|
2016
|
+
declare function describeSecretFindings(file: string, findings: SecretFinding[]): string;
|
|
2017
|
+
|
|
1998
2018
|
interface AppConfig {
|
|
1999
2019
|
project: {
|
|
2000
2020
|
name: string;
|
|
@@ -2704,6 +2724,8 @@ interface CombinedMeta {
|
|
|
2704
2724
|
pipelineRunId?: string;
|
|
2705
2725
|
taskIds?: string[];
|
|
2706
2726
|
}
|
|
2727
|
+
/** Serialized size budget for a single report (roadmap §17 — output limits). */
|
|
2728
|
+
declare const MAX_REPORT_BYTES: number;
|
|
2707
2729
|
interface CollectionDiagnostics {
|
|
2708
2730
|
collected: number;
|
|
2709
2731
|
accepted: number;
|
|
@@ -3080,6 +3102,6 @@ declare function migrateProjectStores(directory?: string, options?: {
|
|
|
3080
3102
|
checkOnly?: boolean;
|
|
3081
3103
|
}): Promise<MigrationReport[]>;
|
|
3082
3104
|
|
|
3083
|
-
declare const OMNINODE_VERSION = "2.0.0-alpha.
|
|
3105
|
+
declare const OMNINODE_VERSION = "2.0.0-alpha.13";
|
|
3084
3106
|
|
|
3085
|
-
export { AgentAdapterRegistry, type AgentConfig, type AgentConfigYaml, type AgentDescriptor, AgentError, type AgentInfo, type AgentInputMode, type AgentIntegrationType, AgentRegistry, type AgentStatus, type AgentTaskInput, type AgentTaskOutput, type AgentToNodeMessage, type AggregateOptions, type AggregatedFinding, type AggregatedRecommendation, type AppConfig, type AppConfigYaml, type ArtifactKind, type ArtifactPayload, type AskedQuestion, type AuditAction, type AuditEvent, type AuditSink, type AuditSink as AuditStore, type ChatFn, type ChatMessage, type ChatRequest, type ChatResponse, type ChatRole, type ChatStreamChunk, type ChatUsage, type CollectionDiagnostics, type CombinedMeta, type CombinedReport, type CombinedReportFilter, type Confidence, ConfigError, type ConflictPosition, ConsoleLogSink, type CreateTaskInput, type CwdValidation, DEFAULT_MAX_OUTPUT_BYTES, type DecodeResult, type DiscoveryResult, type DocumentState, type EnvPolicy, type EnvelopeMeta, type Evidence, type EvidenceInput, type EvidenceKind, type ExecutionRecord, type ExtractionMeta, FileAuditLog, FilePipelineRunStore, FilePlanStore, FileReportStore, FileTaskStore, type Finding, type FindingOrigin, type FindingSeverity, type FindingSource, type HelloResult, HeuristicPlanner, type HttpRequestOptions, type HttpResponse, type IAgent, type IAgentAdapter, type IChatProvider, type IMemoryProvider, type IPipelineExecutor, type IPlanner, type IProvider, type JsonDocument, JsonFileStore, type JsonFileStoreOptions, type LoadConfigOptions, LocalMemoryProvider, type LogLevel, type LogSink, Logger, type LoggerOptions, MAX_CONTEXT_CHARS, MAX_MESSAGE_BYTES, type MemoryCategory, type MemoryContextQuery, type MemoryEntry, MemoryError, type MemoryProviderConfig, type MemoryProviderMetadata, type MemoryQuery, type MemoryScope, MemoryService, type MemoryServiceOptions, LocalMemoryProvider as MemoryStore, type MemoryTaskContext, type MessageEnvelope, type MigrationReport, type Modality, type ModelCapabilities, type ModelFilter, type ModelInfo, ModelPlanner, ModelRegistry, type ModelStatus, type NodeToAgentMessage, OMNINODE_VERSION, OPENAI_COMPATIBLE_TYPES, type OmniHilbrasConnectionResult, OmniHilbrasProvider, OmniNodeError, type OmniNodeErrorCode, type OmniNodeErrorOptions, OpenAICompatibleProvider, PROTOCOL_V2, type PipelineConfigYaml, type PipelineDefinition, PipelineEngine, type PipelineEngineOptions, PipelineError, type PipelineRun, type PipelineRunAttempt, type PipelineRunFilter, type PipelineRunOptions, type PipelineRunStatus, type PipelineRunStore, type PipelineStep, type PipelineStepCondition, type PipelineStepConfigYaml, type PipelineStepKind, type PipelineStepRun, type PipelineRunStore as PipelineStore, type Plan, type PlanFilter, type PlanJsonResult, type PlanRequest, type PlanStep, type PlanStore, type PlanValidationIssue, type PlanValidationResult, type PlannerConfigYaml, PlannerError, ProcessAgent, ProcessAgentAdapter, type Project, type ProjectConfigYaml, ProjectStores, type ProtocolAgentToNodeType, ProtocolDecoder, type ProtocolEnvelope, ProtocolError, type ProtocolMessageType, type ProtocolNodeToAgentType, ProtocolSession, type ProtocolViolation, type ProtocolViolationCode, type ProviderAuthentication, type ProviderCapability, type ProviderConfig, type ProviderConfigYaml, ProviderError, type ProviderErrorKind, type ProviderHealth, type ProviderStatus, type ProviderType, type QuestionPayload, type QuestionResponder, type RememberaConfig, RememberaMemoryProvider, type Report, type ReportArtifact, type ReportConflict, type ReportFilter, type ReportPayload, ReportService, type ReportStore, type ReportValidationIssue, type ReportValidationResult, type RoleConfigYaml, type RoleDefinition, RoleRegistry, type RunPipelineOptions, SCHEMA_VERSION, STORE_FILES, SUPPORTED_PROTOCOL_VERSIONS, type SessionIds, TERMINAL_TASK_STATUSES, type Task, type TaskContext, TaskEngine, type TaskEngineOptions, TaskError, type TaskPayload, type TaskResult, type TaskStatus, type TaskStore, type TaskStoreFilter, type WritableLike, agentConfigSchema, aggregateReports, appConfigSchema, authHeaders, buildAgentRegistry, buildChildEnv, buildHello, buildHelloAck, buildPipelineEngine, buildPlanner, buildPlannerContext, buildRoleRegistry, composeTaskText, createAgent, createDefaultChatFn, createMemoryProvider, createProvider, createTaskEngine, decodeMessage, decodeStream, defaultMetadata, defaultProjectConfigYaml, defaultSearch, describeExit, detectConflicts, encodeMessage, envelope, expandEnvRefs, extractMessage, extractReportFromText, findConfigFile, inspectDocument, isNetworkError, isOmniNodeError, isRetryable, isSupportedProtocol, isTimeoutError, keywords, killTree, kindFromStatus, loadConfig, logger, migrateProjectStores, newMessageId, normalizeEvidence, normalizeFinding, parseHello, parsePlanJson, parseRetryAfter, pipelineConfigSchema, pipelineStepConfigSchema, planJsonSchema, plannerConfigSchema, projectConfigSchema, providerConfigSchema, providerHttpError, providerTransportError, readDocument, registryKey, requestJson, requireCompletion, resolveApiKey, resolveEnvPolicy, roleConfigSchema, sanitizeChunk, similar, validateEnvelope, validatePlan, validateReport, validateWorkingDirectory, writeFileAtomic };
|
|
3107
|
+
export { AgentAdapterRegistry, type AgentConfig, type AgentConfigYaml, type AgentDescriptor, AgentError, type AgentInfo, type AgentInputMode, type AgentIntegrationType, AgentRegistry, type AgentStatus, type AgentTaskInput, type AgentTaskOutput, type AgentToNodeMessage, type AggregateOptions, type AggregatedFinding, type AggregatedRecommendation, type AppConfig, type AppConfigYaml, type ArtifactKind, type ArtifactPayload, type AskedQuestion, type AuditAction, type AuditEvent, type AuditSink, type AuditSink as AuditStore, type ChatFn, type ChatMessage, type ChatRequest, type ChatResponse, type ChatRole, type ChatStreamChunk, type ChatUsage, type CollectionDiagnostics, type CombinedMeta, type CombinedReport, type CombinedReportFilter, type Confidence, ConfigError, type ConflictPosition, ConsoleLogSink, type CreateTaskInput, type CwdValidation, DEFAULT_MAX_OUTPUT_BYTES, type DecodeResult, type DiscoveryResult, type DocumentState, type EnvPolicy, type EnvelopeMeta, type Evidence, type EvidenceInput, type EvidenceKind, type ExecutionRecord, type ExtractionMeta, FileAuditLog, FilePipelineRunStore, FilePlanStore, FileReportStore, FileTaskStore, type Finding, type FindingOrigin, type FindingSeverity, type FindingSource, type HelloResult, HeuristicPlanner, type HttpRequestOptions, type HttpResponse, type IAgent, type IAgentAdapter, type IChatProvider, type IMemoryProvider, type IPipelineExecutor, type IPlanner, type IProvider, type JsonDocument, JsonFileStore, type JsonFileStoreOptions, type LoadConfigOptions, LocalMemoryProvider, type LogLevel, type LogSink, Logger, type LoggerOptions, MAX_CONTEXT_CHARS, MAX_MESSAGE_BYTES, MAX_REPORT_BYTES, type MemoryCategory, type MemoryContextQuery, type MemoryEntry, MemoryError, type MemoryProviderConfig, type MemoryProviderMetadata, type MemoryQuery, type MemoryScope, MemoryService, type MemoryServiceOptions, LocalMemoryProvider as MemoryStore, type MemoryTaskContext, type MessageEnvelope, type MigrationReport, type Modality, type ModelCapabilities, type ModelFilter, type ModelInfo, ModelPlanner, ModelRegistry, type ModelStatus, type NodeToAgentMessage, OMNINODE_VERSION, OPENAI_COMPATIBLE_TYPES, type OmniHilbrasConnectionResult, OmniHilbrasProvider, OmniNodeError, type OmniNodeErrorCode, type OmniNodeErrorOptions, OpenAICompatibleProvider, PROTOCOL_V2, type PipelineConfigYaml, type PipelineDefinition, PipelineEngine, type PipelineEngineOptions, PipelineError, type PipelineRun, type PipelineRunAttempt, type PipelineRunFilter, type PipelineRunOptions, type PipelineRunStatus, type PipelineRunStore, type PipelineStep, type PipelineStepCondition, type PipelineStepConfigYaml, type PipelineStepKind, type PipelineStepRun, type PipelineRunStore as PipelineStore, type Plan, type PlanFilter, type PlanJsonResult, type PlanRequest, type PlanStep, type PlanStore, type PlanValidationIssue, type PlanValidationResult, type PlannerConfigYaml, PlannerError, ProcessAgent, ProcessAgentAdapter, type Project, type ProjectConfigYaml, ProjectStores, type ProtocolAgentToNodeType, ProtocolDecoder, type ProtocolEnvelope, ProtocolError, type ProtocolMessageType, type ProtocolNodeToAgentType, ProtocolSession, type ProtocolViolation, type ProtocolViolationCode, type ProviderAuthentication, type ProviderCapability, type ProviderConfig, type ProviderConfigYaml, ProviderError, type ProviderErrorKind, type ProviderHealth, type ProviderStatus, type ProviderType, type QuestionPayload, type QuestionResponder, type RememberaConfig, RememberaMemoryProvider, type Report, type ReportArtifact, type ReportConflict, type ReportFilter, type ReportPayload, ReportService, type ReportStore, type ReportValidationIssue, type ReportValidationResult, type RoleConfigYaml, type RoleDefinition, RoleRegistry, type RunPipelineOptions, SCHEMA_VERSION, STORE_FILES, SUPPORTED_PROTOCOL_VERSIONS, type SecretFinding, type SessionIds, TERMINAL_TASK_STATUSES, type Task, type TaskContext, TaskEngine, type TaskEngineOptions, TaskError, type TaskPayload, type TaskResult, type TaskStatus, type TaskStore, type TaskStoreFilter, type WritableLike, agentConfigSchema, aggregateReports, appConfigSchema, authHeaders, buildAgentRegistry, buildChildEnv, buildHello, buildHelloAck, buildPipelineEngine, buildPlanner, buildPlannerContext, buildRoleRegistry, composeTaskText, createAgent, createDefaultChatFn, createMemoryProvider, createProvider, createTaskEngine, decodeMessage, decodeStream, defaultMetadata, defaultProjectConfigYaml, defaultSearch, describeExit, describeSecretFindings, detectConflicts, encodeMessage, envelope, expandEnvRefs, extractMessage, extractReportFromText, findConfigFile, inspectDocument, isNetworkError, isOmniNodeError, isRetryable, isSupportedProtocol, isTimeoutError, keywords, killTree, kindFromStatus, loadConfig, logger, migrateProjectStores, newMessageId, normalizeEvidence, normalizeFinding, parseHello, parsePlanJson, parseRetryAfter, pipelineConfigSchema, pipelineStepConfigSchema, planJsonSchema, plannerConfigSchema, projectConfigSchema, providerConfigSchema, providerHttpError, providerTransportError, readDocument, registryKey, requestJson, requireCompletion, resolveApiKey, resolveEnvPolicy, roleConfigSchema, sanitizeChunk, scanForInlineSecrets, similar, validateEnvelope, validatePlan, validateReport, validateWorkingDirectory, writeFileAtomic };
|
package/dist/index.js
CHANGED
|
@@ -202,6 +202,39 @@ var appConfigSchema = z.object({
|
|
|
202
202
|
logging: z.object({ level: z.enum(["debug", "info", "warn", "error"]) }).strict().optional()
|
|
203
203
|
}).strict();
|
|
204
204
|
|
|
205
|
+
// src/config/secrets.ts
|
|
206
|
+
var SAFE_KEY_SUFFIXES = ["_env", "_env_var", "_file", "_path", "_ref", "_id", "_url", "_command"];
|
|
207
|
+
var SECRET_KEY = /^\s*([A-Za-z0-9_-]*(?:api[_-]?key|token|password|passwd|secret|credential)[A-Za-z0-9_-]*)\s*:\s*(.*)$/i;
|
|
208
|
+
var SAFE_VALUE = /^\s*(?:\$\{[^}]*\}|\$[A-Z_][A-Z0-9_]*|<[^>]*>|""|''|null|~)\s*$/i;
|
|
209
|
+
function scanForInlineSecrets(source) {
|
|
210
|
+
const findings = [];
|
|
211
|
+
source.split("\n").forEach((line, index) => {
|
|
212
|
+
const trimmed = line.trim();
|
|
213
|
+
if (trimmed.startsWith("#")) return;
|
|
214
|
+
const match = SECRET_KEY.exec(line);
|
|
215
|
+
if (!match) return;
|
|
216
|
+
const key = match[1] ?? "";
|
|
217
|
+
const rawValue = (match[2] ?? "").trim().replace(/,\s*$/, "");
|
|
218
|
+
const keyIsReference = SAFE_KEY_SUFFIXES.some((suffix) => key.toLowerCase().endsWith(suffix));
|
|
219
|
+
if (keyIsReference) return;
|
|
220
|
+
const value = rawValue.replace(/^["']|["']$/g, "");
|
|
221
|
+
if (value.length === 0 || SAFE_VALUE.test(rawValue)) return;
|
|
222
|
+
if (value.length < 8) return;
|
|
223
|
+
findings.push({
|
|
224
|
+
line: index + 1,
|
|
225
|
+
key,
|
|
226
|
+
excerpt: `${key}: ${value.slice(0, 3)}\u2026 (${value.length} chars, redacted)`
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
return findings;
|
|
230
|
+
}
|
|
231
|
+
function describeSecretFindings(file, findings) {
|
|
232
|
+
const lines = findings.map((f) => ` line ${f.line}: ${f.excerpt}`).join("\n");
|
|
233
|
+
return `${file} appears to contain ${findings.length} inline secret(s):
|
|
234
|
+
${lines}
|
|
235
|
+
OmniNode never stores credentials in configuration. Replace each value with an environment-variable reference, e.g. api_key_env_var: MY_API_KEY.`;
|
|
236
|
+
}
|
|
237
|
+
|
|
205
238
|
// src/config/loader.ts
|
|
206
239
|
import { existsSync, readFileSync } from "fs";
|
|
207
240
|
import { parse as parseYaml } from "yaml";
|
|
@@ -238,6 +271,10 @@ function loadConfig(options = {}) {
|
|
|
238
271
|
);
|
|
239
272
|
}
|
|
240
273
|
const raw = readFileSync(path, "utf8");
|
|
274
|
+
const secretFindings = scanForInlineSecrets(raw);
|
|
275
|
+
if (secretFindings.length > 0) {
|
|
276
|
+
throw new ConfigError("CONFIG_INVALID", describeSecretFindings(path, secretFindings));
|
|
277
|
+
}
|
|
241
278
|
const expanded = expandEnvRefs(raw, env, path);
|
|
242
279
|
let data;
|
|
243
280
|
try {
|
|
@@ -3896,6 +3933,7 @@ function truncate3(text, max) {
|
|
|
3896
3933
|
}
|
|
3897
3934
|
|
|
3898
3935
|
// src/reports/service.ts
|
|
3936
|
+
var MAX_REPORT_BYTES = 256 * 1024;
|
|
3899
3937
|
var ReportService = class {
|
|
3900
3938
|
constructor(store, log = logger) {
|
|
3901
3939
|
this.store = store;
|
|
@@ -3930,6 +3968,16 @@ var ReportService = class {
|
|
|
3930
3968
|
const reports = [];
|
|
3931
3969
|
const rejected = [];
|
|
3932
3970
|
for (const candidate of candidates) {
|
|
3971
|
+
const size = Buffer.byteLength(JSON.stringify(candidate), "utf8");
|
|
3972
|
+
if (size > MAX_REPORT_BYTES) {
|
|
3973
|
+
rejected.push({
|
|
3974
|
+
key: candidate?.id ?? "(unknown)",
|
|
3975
|
+
reason: `report exceeds the ${MAX_REPORT_BYTES} byte limit (${size} bytes)`,
|
|
3976
|
+
issues: []
|
|
3977
|
+
});
|
|
3978
|
+
this.log.warn(`Rejected oversized report (${size} bytes).`);
|
|
3979
|
+
continue;
|
|
3980
|
+
}
|
|
3933
3981
|
const result = validateReport(candidate);
|
|
3934
3982
|
if (result.valid) {
|
|
3935
3983
|
reports.push(result.report);
|
|
@@ -4102,7 +4150,7 @@ async function migrateProjectStores(directory = `${process.cwd()}/.omninode`, op
|
|
|
4102
4150
|
}
|
|
4103
4151
|
|
|
4104
4152
|
// src/version.ts
|
|
4105
|
-
var OMNINODE_VERSION = "2.0.0-alpha.
|
|
4153
|
+
var OMNINODE_VERSION = "2.0.0-alpha.13";
|
|
4106
4154
|
export {
|
|
4107
4155
|
AgentAdapterRegistry,
|
|
4108
4156
|
AgentError,
|
|
@@ -4121,6 +4169,7 @@ export {
|
|
|
4121
4169
|
Logger,
|
|
4122
4170
|
MAX_CONTEXT_CHARS,
|
|
4123
4171
|
MAX_MESSAGE_BYTES,
|
|
4172
|
+
MAX_REPORT_BYTES,
|
|
4124
4173
|
MemoryError,
|
|
4125
4174
|
MemoryService,
|
|
4126
4175
|
ModelPlanner,
|
|
@@ -4174,6 +4223,7 @@ export {
|
|
|
4174
4223
|
defaultProjectConfigYaml,
|
|
4175
4224
|
defaultSearch,
|
|
4176
4225
|
describeExit,
|
|
4226
|
+
describeSecretFindings,
|
|
4177
4227
|
detectConflicts,
|
|
4178
4228
|
encodeMessage,
|
|
4179
4229
|
envelope,
|
|
@@ -4215,6 +4265,7 @@ export {
|
|
|
4215
4265
|
resolveEnvPolicy,
|
|
4216
4266
|
roleConfigSchema,
|
|
4217
4267
|
sanitizeChunk,
|
|
4268
|
+
scanForInlineSecrets,
|
|
4218
4269
|
similar,
|
|
4219
4270
|
validateEnvelope,
|
|
4220
4271
|
validatePlan,
|