@shardworks/nexus-core 0.1.99 → 0.1.101
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 +95 -166
- package/dist/guild-config.d.ts +14 -52
- package/dist/guild-config.d.ts.map +1 -1
- package/dist/guild-config.js +7 -10
- package/dist/guild-config.js.map +1 -1
- package/dist/guild.d.ts +83 -0
- package/dist/guild.d.ts.map +1 -0
- package/dist/guild.js +45 -0
- package/dist/guild.js.map +1 -0
- package/dist/id.d.ts +14 -0
- package/dist/id.d.ts.map +1 -0
- package/dist/id.js +19 -0
- package/dist/id.js.map +1 -0
- package/dist/index.d.ts +6 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -32
- package/dist/index.js.map +1 -1
- package/dist/nexus-home.d.ts +0 -4
- package/dist/nexus-home.d.ts.map +1 -1
- package/dist/nexus-home.js +1 -9
- package/dist/nexus-home.js.map +1 -1
- package/dist/plugin.d.ts +115 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +39 -0
- package/dist/plugin.js.map +1 -0
- package/dist/resolve-package.d.ts +58 -0
- package/dist/resolve-package.d.ts.map +1 -0
- package/dist/resolve-package.js +123 -0
- package/dist/resolve-package.js.map +1 -0
- package/package.json +5 -14
- package/dist/book.d.ts +0 -110
- package/dist/book.d.ts.map +0 -1
- package/dist/book.js +0 -16
- package/dist/book.js.map +0 -1
- package/dist/legacy/1/anima.d.ts +0 -79
- package/dist/legacy/1/anima.d.ts.map +0 -1
- package/dist/legacy/1/anima.js +0 -285
- package/dist/legacy/1/anima.js.map +0 -1
- package/dist/legacy/1/audit.d.ts +0 -23
- package/dist/legacy/1/audit.d.ts.map +0 -1
- package/dist/legacy/1/audit.js +0 -61
- package/dist/legacy/1/audit.js.map +0 -1
- package/dist/legacy/1/bundle.d.ts +0 -111
- package/dist/legacy/1/bundle.d.ts.map +0 -1
- package/dist/legacy/1/bundle.js +0 -452
- package/dist/legacy/1/bundle.js.map +0 -1
- package/dist/legacy/1/clock-daemon.d.ts +0 -2
- package/dist/legacy/1/clock-daemon.d.ts.map +0 -1
- package/dist/legacy/1/clock-daemon.js +0 -72
- package/dist/legacy/1/clock-daemon.js.map +0 -1
- package/dist/legacy/1/clockworks.d.ts +0 -98
- package/dist/legacy/1/clockworks.d.ts.map +0 -1
- package/dist/legacy/1/clockworks.js +0 -359
- package/dist/legacy/1/clockworks.js.map +0 -1
- package/dist/legacy/1/conversation.d.ts +0 -165
- package/dist/legacy/1/conversation.d.ts.map +0 -1
- package/dist/legacy/1/conversation.js +0 -457
- package/dist/legacy/1/conversation.js.map +0 -1
- package/dist/legacy/1/engine.d.ts +0 -90
- package/dist/legacy/1/engine.d.ts.map +0 -1
- package/dist/legacy/1/engine.js +0 -89
- package/dist/legacy/1/engine.js.map +0 -1
- package/dist/legacy/1/events.d.ts +0 -88
- package/dist/legacy/1/events.d.ts.map +0 -1
- package/dist/legacy/1/events.js +0 -239
- package/dist/legacy/1/events.js.map +0 -1
- package/dist/legacy/1/guild-config.d.ts +0 -74
- package/dist/legacy/1/guild-config.d.ts.map +0 -1
- package/dist/legacy/1/guild-config.js +0 -51
- package/dist/legacy/1/guild-config.js.map +0 -1
- package/dist/legacy/1/id.d.ts +0 -8
- package/dist/legacy/1/id.d.ts.map +0 -1
- package/dist/legacy/1/id.js +0 -27
- package/dist/legacy/1/id.js.map +0 -1
- package/dist/legacy/1/index.d.ts +0 -28
- package/dist/legacy/1/index.d.ts.map +0 -1
- package/dist/legacy/1/index.js +0 -32
- package/dist/legacy/1/index.js.map +0 -1
- package/dist/legacy/1/init-guild.d.ts +0 -24
- package/dist/legacy/1/init-guild.d.ts.map +0 -1
- package/dist/legacy/1/init-guild.js +0 -230
- package/dist/legacy/1/init-guild.js.map +0 -1
- package/dist/legacy/1/install-tool.d.ts +0 -73
- package/dist/legacy/1/install-tool.d.ts.map +0 -1
- package/dist/legacy/1/install-tool.js +0 -436
- package/dist/legacy/1/install-tool.js.map +0 -1
- package/dist/legacy/1/instantiate.d.ts +0 -33
- package/dist/legacy/1/instantiate.d.ts.map +0 -1
- package/dist/legacy/1/instantiate.js +0 -137
- package/dist/legacy/1/instantiate.js.map +0 -1
- package/dist/legacy/1/manifest.d.ts +0 -132
- package/dist/legacy/1/manifest.d.ts.map +0 -1
- package/dist/legacy/1/manifest.js +0 -321
- package/dist/legacy/1/manifest.js.map +0 -1
- package/dist/legacy/1/migrate.d.ts +0 -84
- package/dist/legacy/1/migrate.d.ts.map +0 -1
- package/dist/legacy/1/migrate.js +0 -228
- package/dist/legacy/1/migrate.js.map +0 -1
- package/dist/legacy/1/nexus-home.d.ts +0 -11
- package/dist/legacy/1/nexus-home.d.ts.map +0 -1
- package/dist/legacy/1/nexus-home.js +0 -16
- package/dist/legacy/1/nexus-home.js.map +0 -1
- package/dist/legacy/1/plugin-descriptor.d.ts +0 -3
- package/dist/legacy/1/plugin-descriptor.d.ts.map +0 -1
- package/dist/legacy/1/plugin-descriptor.js +0 -2
- package/dist/legacy/1/plugin-descriptor.js.map +0 -1
- package/dist/legacy/1/preconditions.d.ts +0 -100
- package/dist/legacy/1/preconditions.d.ts.map +0 -1
- package/dist/legacy/1/preconditions.js +0 -189
- package/dist/legacy/1/preconditions.js.map +0 -1
- package/dist/legacy/1/rehydrate.d.ts +0 -22
- package/dist/legacy/1/rehydrate.d.ts.map +0 -1
- package/dist/legacy/1/rehydrate.js +0 -109
- package/dist/legacy/1/rehydrate.js.map +0 -1
- package/dist/legacy/1/remove-tool.d.ts +0 -19
- package/dist/legacy/1/remove-tool.d.ts.map +0 -1
- package/dist/legacy/1/remove-tool.js +0 -105
- package/dist/legacy/1/remove-tool.js.map +0 -1
- package/dist/legacy/1/session.d.ts +0 -343
- package/dist/legacy/1/session.d.ts.map +0 -1
- package/dist/legacy/1/session.js +0 -499
- package/dist/legacy/1/session.js.map +0 -1
- package/dist/legacy/1/tool-registry.d.ts +0 -12
- package/dist/legacy/1/tool-registry.d.ts.map +0 -1
- package/dist/legacy/1/tool-registry.js +0 -28
- package/dist/legacy/1/tool-registry.js.map +0 -1
- package/dist/legacy/1/tool.d.ts +0 -10
- package/dist/legacy/1/tool.d.ts.map +0 -1
- package/dist/legacy/1/tool.js +0 -2
- package/dist/legacy/1/tool.js.map +0 -1
- package/dist/legacy/1/upgrade.d.ts +0 -129
- package/dist/legacy/1/upgrade.d.ts.map +0 -1
- package/dist/legacy/1/upgrade.js +0 -355
- package/dist/legacy/1/upgrade.js.map +0 -1
- package/dist/legacy/1/workshop.d.ts +0 -95
- package/dist/legacy/1/workshop.d.ts.map +0 -1
- package/dist/legacy/1/workshop.js +0 -229
- package/dist/legacy/1/workshop.js.map +0 -1
- package/dist/legacy/1/worktree.d.ts +0 -67
- package/dist/legacy/1/worktree.d.ts.map +0 -1
- package/dist/legacy/1/worktree.js +0 -117
- package/dist/legacy/1/worktree.js.map +0 -1
- package/dist/legacy/1/writ.d.ts +0 -130
- package/dist/legacy/1/writ.d.ts.map +0 -1
- package/dist/legacy/1/writ.js +0 -599
- package/dist/legacy/1/writ.js.map +0 -1
- package/dist/rig-context.d.ts +0 -47
- package/dist/rig-context.d.ts.map +0 -1
- package/dist/rig-context.js +0 -11
- package/dist/rig-context.js.map +0 -1
- package/dist/rig-descriptor.d.ts +0 -39
- package/dist/rig-descriptor.d.ts.map +0 -1
- package/dist/rig-descriptor.js +0 -12
- package/dist/rig-descriptor.js.map +0 -1
- package/dist/rig.d.ts +0 -70
- package/dist/rig.d.ts.map +0 -1
- package/dist/rig.js +0 -14
- package/dist/rig.js.map +0 -1
- package/dist/tool.d.ts +0 -136
- package/dist/tool.d.ts.map +0 -1
- package/dist/tool.js +0 -135
- package/dist/tool.js.map +0 -1
- package/migrations/001-schema.sql +0 -177
- package/migrations/002-writs.sql +0 -44
- package/migrations/003-conversations.sql +0 -43
- package/migrations/004-remove-commissions.sql +0 -24
package/dist/id.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
/**
|
|
3
|
+
* Generate a sortable, prefixed ID.
|
|
4
|
+
*
|
|
5
|
+
* Format: `{prefix}-{base36_timestamp}-{hex_random}`
|
|
6
|
+
*
|
|
7
|
+
* The timestamp component (Date.now() in base36) gives lexicographic sort
|
|
8
|
+
* order by creation time. The random suffix prevents collisions without
|
|
9
|
+
* coordination.
|
|
10
|
+
*
|
|
11
|
+
* @param prefix Short, type-identifying string (e.g. `w`, `ses`, `turn`)
|
|
12
|
+
* @param randomByteCount Number of random bytes; produces 2× hex digits (default 6 → 12 hex chars)
|
|
13
|
+
*/
|
|
14
|
+
export function generateId(prefix, randomByteCount = 6) {
|
|
15
|
+
const ts = Date.now().toString(36);
|
|
16
|
+
const rand = crypto.randomBytes(randomByteCount).toString('hex');
|
|
17
|
+
return `${prefix}-${ts}-${rand}`;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=id.js.map
|
package/dist/id.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id.js","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,kBAA0B,CAAC;IACpE,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjE,OAAO,GAAG,MAAM,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC;AACnC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,8 @@
|
|
|
1
1
|
export declare const VERSION: string;
|
|
2
|
-
export { type
|
|
3
|
-
export { type
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export { type
|
|
7
|
-
export {
|
|
8
|
-
export { type GuildConfigV2, createInitialGuildConfigV2, readGuildConfigV2, writeGuildConfigV2, type RoleDefinition, type WorkshopEntry, type EventDeclaration, type StandingOrder, type ClockworksConfig, type WritTypeDeclaration, type GuildSettings, guildConfigPath, } from './guild-config.ts';
|
|
9
|
-
export { type RigDescriptor, type RigDependency, } from './rig-descriptor.ts';
|
|
10
|
-
export { type GuildEvent, type EngineContext, type EngineDefinition, engine, isClockworkEngine, resolveEngineFromExport, } from './legacy/1/engine.ts';
|
|
11
|
-
export { signalEvent, validateCustomEvent, isFrameworkEvent, readPendingEvents, readEvent, markEventProcessed, recordDispatch, type ListEventsOptions, type DispatchRecord, type ListDispatchesOptions, listEvents, listDispatches, } from './legacy/1/events.ts';
|
|
12
|
-
export { type TickResult, type DispatchSummary, type ClockRunResult, type ClockStartOptions, type ClockStartResult, type ClockStopResult, type ClockStatus, clockTick, clockRun, clockStart, clockStop, clockStatus, desugarOrder, extractParams, } from './legacy/1/clockworks.ts';
|
|
13
|
-
export { type InstallToolOptions, type InstallResult, type SourceKind, classifySource, installTool, } from './legacy/1/install-tool.ts';
|
|
14
|
-
export { type RemoveToolOptions, type RemoveResult, removeTool, } from './legacy/1/remove-tool.ts';
|
|
15
|
-
export { type InstantiateOptions, type InstantiateResult, instantiate, } from './legacy/1/instantiate.ts';
|
|
16
|
-
export { initGuild } from './legacy/1/init-guild.ts';
|
|
17
|
-
export { type BundleManifest, type BundlePackageEntry, type BundleContentEntry, type BundleMigrationEntry, type InstallBundleOptions, type InstallBundleResult, readBundleManifest, installBundle, isBundleDir, } from './legacy/1/bundle.ts';
|
|
18
|
-
export { type RehydrateResult, rehydrate, } from './legacy/1/rehydrate.ts';
|
|
19
|
-
export { type AddWorkshopOptions, type AddWorkshopResult, type RemoveWorkshopOptions, type WorkshopInfo, type WorkshopDetail, type CreateWorkshopOptions, addWorkshop, removeWorkshop, listWorkshops, showWorkshop, createWorkshop, checkGhAuth, deriveWorkshopName, } from './legacy/1/workshop.ts';
|
|
20
|
-
export { type Precondition, type CommandPrecondition, type CommandOutputPrecondition, type EnvPrecondition, type PreconditionCheckResult, type ToolPreconditionResult, readPreconditions, checkOne, checkPreconditions, checkAllPreconditions, checkToolPreconditions, } from './legacy/1/preconditions.ts';
|
|
21
|
-
export { type WorktreeConfig, type WorktreeResult, setupWorktree, teardownWorktree, listWorktrees, } from './legacy/1/worktree.ts';
|
|
22
|
-
export { type MigrationFile, type MigrationProvenance, type MigrateResult, discoverMigrations, applyMigrations, applyCoreMigrations, ensureBooks, } from './legacy/1/migrate.ts';
|
|
23
|
-
export { type AnimaRecord, type ResolvedTool, type UnavailableTool, type ManifestResult, readAnima, resolveTools, readCodex, readRoleInstructions, assembleSystemPrompt, manifest, } from './legacy/1/manifest.ts';
|
|
24
|
-
export { type SessionProvider, type SessionProviderLaunchOptions, type SessionProviderResult, type SessionLaunchOptions, type SessionResult, type SessionChunk, type WorkspaceContext, type ResolvedWorkspace, type SessionRecord, type SessionSummary, type SessionDetail, type ListSessionsOptions, registerSessionProvider, getSessionProvider, resolveWorkspace, createTempWorktree, removeTempWorktree, launchSession, listSessions, countSessionsForWrit, showSession, } from './legacy/1/session.ts';
|
|
25
|
-
export { type ConversationChunk, type CreateConversationOptions, type CreateConversationResult, type ConversationSummary, type ConversationDetail, type ListConversationsOptions, createConversation, takeTurn, endConversation, nextParticipant, listConversations, showConversation, formatConveneMessage, } from './legacy/1/conversation.ts';
|
|
26
|
-
export { type UpgradePlan, type UpgradeResult, type ApplyUpgradeOptions, type MigrationPlanEntry, type ContentUpdateEntry, type ToolPlanEntry, type StaleAnimaEntry, planUpgrade, applyUpgrade, } from './legacy/1/upgrade.ts';
|
|
27
|
-
export { generateId } from './legacy/1/id.ts';
|
|
28
|
-
export { type AnimaSummary, type AnimaDetail, type ListAnimasOptions, type UpdateAnimaOptions, type AnimaStaleness, type StalenessInfo, resolveAnimaByRole, listAnimas, showAnima, updateAnima, removeAnima, checkAnimaStaleness, checkAllAnimaStaleness, } from './legacy/1/anima.ts';
|
|
29
|
-
export { type ToolSummary, listTools, } from './legacy/1/tool-registry.ts';
|
|
30
|
-
export { type WritRecord, type WritStatus, type CreateWritOptions, type ListWritsOptions, type WritChildSummary, BUILTIN_WRIT_TYPES, validateWritType, createWrit, readWrit, listWrits, activateWrit, completeWrit, adminCompleteWrit, failWrit, cancelWrit, interruptWrit, reopenFailedWrit, rollupParent, getWritChildren, buildProgressAppendix, hydratePromptTemplate, } from './legacy/1/writ.ts';
|
|
31
|
-
export { type AuditEntry, type ListAuditLogOptions, listAuditLog, } from './legacy/1/audit.ts';
|
|
2
|
+
export { type Kit, type Apparatus, type Plugin, type LoadedKit, type LoadedApparatus, type LoadedPlugin, type StartupContext, isKit, isApparatus, isLoadedKit, isLoadedApparatus, } from './plugin.ts';
|
|
3
|
+
export { type Guild, guild, setGuild, clearGuild, } from './guild.ts';
|
|
4
|
+
export { findGuildRoot, nexusDir, worktreesPath, clockPidPath, clockLogPath, } from './nexus-home.ts';
|
|
5
|
+
export { derivePluginId, readGuildPackageJson, resolvePackageNameForPluginId, resolveGuildPackageEntry, } from './resolve-package.ts';
|
|
6
|
+
export { type GuildConfig, createInitialGuildConfig, readGuildConfig, writeGuildConfig, type EventDeclaration, type StandingOrder, type ClockworksConfig, type GuildSettings, guildConfigPath, } from './guild-config.ts';
|
|
7
|
+
export { generateId } from './id.ts';
|
|
32
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO,EAAE,MAAqB,CAAC;AAI5C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO,EAAE,MAAqB,CAAC;AAI5C,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,EACL,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,KAAK,KAAK,EACV,KAAK,EACL,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,aAAa,EACb,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,KAAK,WAAW,EAChB,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,36 +4,11 @@ const _require = createRequire(import.meta.url);
|
|
|
4
4
|
const _pkg = _require('../package.json');
|
|
5
5
|
export const VERSION = _pkg.version;
|
|
6
6
|
// ── Promoted modules — canonical source lives here at top-level ────────
|
|
7
|
-
export {
|
|
8
|
-
|
|
9
|
-
export {} from "./
|
|
10
|
-
export {
|
|
11
|
-
|
|
12
|
-
export {} from "./
|
|
13
|
-
export {
|
|
14
|
-
export { createInitialGuildConfigV2, readGuildConfigV2, writeGuildConfigV2, guildConfigPath, } from "./guild-config.js";
|
|
15
|
-
export {} from "./rig-descriptor.js";
|
|
16
|
-
// ── Legacy modules — not yet promoted, still live in legacy/1 ─────────
|
|
17
|
-
export { engine, isClockworkEngine, resolveEngineFromExport, } from "./legacy/1/engine.js";
|
|
18
|
-
export { signalEvent, validateCustomEvent, isFrameworkEvent, readPendingEvents, readEvent, markEventProcessed, recordDispatch, listEvents, listDispatches, } from "./legacy/1/events.js";
|
|
19
|
-
export { clockTick, clockRun, clockStart, clockStop, clockStatus, desugarOrder, extractParams, } from "./legacy/1/clockworks.js";
|
|
20
|
-
export { classifySource, installTool, } from "./legacy/1/install-tool.js";
|
|
21
|
-
export { removeTool, } from "./legacy/1/remove-tool.js";
|
|
22
|
-
export { instantiate, } from "./legacy/1/instantiate.js";
|
|
23
|
-
export { initGuild } from "./legacy/1/init-guild.js";
|
|
24
|
-
export { readBundleManifest, installBundle, isBundleDir, } from "./legacy/1/bundle.js";
|
|
25
|
-
export { rehydrate, } from "./legacy/1/rehydrate.js";
|
|
26
|
-
export { addWorkshop, removeWorkshop, listWorkshops, showWorkshop, createWorkshop, checkGhAuth, deriveWorkshopName, } from "./legacy/1/workshop.js";
|
|
27
|
-
export { readPreconditions, checkOne, checkPreconditions, checkAllPreconditions, checkToolPreconditions, } from "./legacy/1/preconditions.js";
|
|
28
|
-
export { setupWorktree, teardownWorktree, listWorktrees, } from "./legacy/1/worktree.js";
|
|
29
|
-
export { discoverMigrations, applyMigrations, applyCoreMigrations, ensureBooks, } from "./legacy/1/migrate.js";
|
|
30
|
-
export { readAnima, resolveTools, readCodex, readRoleInstructions, assembleSystemPrompt, manifest, } from "./legacy/1/manifest.js";
|
|
31
|
-
export { registerSessionProvider, getSessionProvider, resolveWorkspace, createTempWorktree, removeTempWorktree, launchSession, listSessions, countSessionsForWrit, showSession, } from "./legacy/1/session.js";
|
|
32
|
-
export { createConversation, takeTurn, endConversation, nextParticipant, listConversations, showConversation, formatConveneMessage, } from "./legacy/1/conversation.js";
|
|
33
|
-
export { planUpgrade, applyUpgrade, } from "./legacy/1/upgrade.js";
|
|
34
|
-
export { generateId } from "./legacy/1/id.js";
|
|
35
|
-
export { resolveAnimaByRole, listAnimas, showAnima, updateAnima, removeAnima, checkAnimaStaleness, checkAllAnimaStaleness, } from "./legacy/1/anima.js";
|
|
36
|
-
export { listTools, } from "./legacy/1/tool-registry.js";
|
|
37
|
-
export { BUILTIN_WRIT_TYPES, validateWritType, createWrit, readWrit, listWrits, activateWrit, completeWrit, adminCompleteWrit, failWrit, cancelWrit, interruptWrit, reopenFailedWrit, rollupParent, getWritChildren, buildProgressAppendix, hydratePromptTemplate, } from "./legacy/1/writ.js";
|
|
38
|
-
export { listAuditLog, } from "./legacy/1/audit.js";
|
|
7
|
+
export { isKit, isApparatus, isLoadedKit, isLoadedApparatus, } from "./plugin.js";
|
|
8
|
+
// Guild — the process-level singleton for accessing guild infrastructure.
|
|
9
|
+
export { guild, setGuild, clearGuild, } from "./guild.js";
|
|
10
|
+
export { findGuildRoot, nexusDir, worktreesPath, clockPidPath, clockLogPath, } from "./nexus-home.js";
|
|
11
|
+
export { derivePluginId, readGuildPackageJson, resolvePackageNameForPluginId, resolveGuildPackageEntry, } from "./resolve-package.js";
|
|
12
|
+
export { createInitialGuildConfig, readGuildConfig, writeGuildConfig, guildConfigPath, } from "./guild-config.js";
|
|
13
|
+
export { generateId } from "./id.js";
|
|
39
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,OAAO,GAAW,IAAI,CAAC,OAAO,CAAC;AAE5C,0EAA0E;AAE1E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,OAAO,GAAW,IAAI,CAAC,OAAO,CAAC;AAE5C,0EAA0E;AAE1E,OAAO,EASL,KAAK,EACL,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,0EAA0E;AAC1E,OAAO,EAEL,KAAK,EACL,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,aAAa,EACb,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAKhB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/nexus-home.d.ts
CHANGED
|
@@ -12,10 +12,6 @@ export declare function findGuildRoot(startDir?: string): string;
|
|
|
12
12
|
export declare function nexusDir(home: string): string;
|
|
13
13
|
/** Path to the top-level worktrees directory (for writ worktrees). */
|
|
14
14
|
export declare function worktreesPath(home: string): string;
|
|
15
|
-
/** Path to the workshops directory (contains bare clones). */
|
|
16
|
-
export declare function workshopsPath(home: string): string;
|
|
17
|
-
/** Path to a specific workshop's bare clone. */
|
|
18
|
-
export declare function workshopBarePath(home: string, name: string): string;
|
|
19
15
|
/** Path to the clockworks daemon PID file. */
|
|
20
16
|
export declare function clockPidPath(home: string): string;
|
|
21
17
|
/** Path to the clockworks daemon log file. */
|
package/dist/nexus-home.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nexus-home.d.ts","sourceRoot":"","sources":["../src/nexus-home.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAYvD;AAED,sDAAsD;AACtD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,
|
|
1
|
+
{"version":3,"file":"nexus-home.d.ts","sourceRoot":"","sources":["../src/nexus-home.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAYvD;AAED,sDAAsD;AACtD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,8CAA8C;AAC9C,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,8CAA8C;AAC9C,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
package/dist/nexus-home.js
CHANGED
|
@@ -16,7 +16,7 @@ export function findGuildRoot(startDir) {
|
|
|
16
16
|
return dir;
|
|
17
17
|
const parent = path.dirname(dir);
|
|
18
18
|
if (parent === dir) {
|
|
19
|
-
throw new Error('Not inside a guild. Run `
|
|
19
|
+
throw new Error('Not inside a guild. Run `nsg init` to create one, or use --guild-root.');
|
|
20
20
|
}
|
|
21
21
|
dir = parent;
|
|
22
22
|
}
|
|
@@ -29,14 +29,6 @@ export function nexusDir(home) {
|
|
|
29
29
|
export function worktreesPath(home) {
|
|
30
30
|
return path.join(home, '.nexus', 'worktrees');
|
|
31
31
|
}
|
|
32
|
-
/** Path to the workshops directory (contains bare clones). */
|
|
33
|
-
export function workshopsPath(home) {
|
|
34
|
-
return path.join(home, '.nexus', 'workshops');
|
|
35
|
-
}
|
|
36
|
-
/** Path to a specific workshop's bare clone. */
|
|
37
|
-
export function workshopBarePath(home, name) {
|
|
38
|
-
return path.join(home, '.nexus', 'workshops', `${name}.git`);
|
|
39
|
-
}
|
|
40
32
|
/** Path to the clockworks daemon PID file. */
|
|
41
33
|
export function clockPidPath(home) {
|
|
42
34
|
return path.join(home, '.nexus', 'clock.pid');
|
package/dist/nexus-home.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nexus-home.js","sourceRoot":"","sources":["../src/nexus-home.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,QAAiB;IAC7C,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAClD,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;YAAE,OAAO,GAAG,CAAC;QAC5D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CACb,
|
|
1
|
+
{"version":3,"file":"nexus-home.js","sourceRoot":"","sources":["../src/nexus-home.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,QAAiB;IAC7C,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAClD,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;YAAE,OAAO,GAAG,CAAC;QAC5D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CACb,wEAAwE,CACzE,CAAC;QACJ,CAAC;QACD,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;AACH,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACnC,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAChD,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAChD,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAChD,CAAC"}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin system — core types for the Kit/Apparatus model.
|
|
3
|
+
*
|
|
4
|
+
* Plugins come in two kinds:
|
|
5
|
+
* - Kit: passive package contributing capabilities to consuming apparatuses.
|
|
6
|
+
* No lifecycle, no running state. Read at load time.
|
|
7
|
+
* - Apparatus: package contributing persistent running infrastructure.
|
|
8
|
+
* Has a start/stop lifecycle. Receives StartupContext at start.
|
|
9
|
+
*
|
|
10
|
+
* See: docs/architecture/plugins.md
|
|
11
|
+
*/
|
|
12
|
+
/** A kit as tracked by the Arbor runtime. */
|
|
13
|
+
export interface LoadedKit {
|
|
14
|
+
readonly packageName: string;
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly version: string;
|
|
17
|
+
readonly kit: Kit;
|
|
18
|
+
}
|
|
19
|
+
/** An apparatus as tracked by the Arbor runtime. */
|
|
20
|
+
export interface LoadedApparatus {
|
|
21
|
+
readonly packageName: string;
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly version: string;
|
|
24
|
+
readonly apparatus: Apparatus;
|
|
25
|
+
}
|
|
26
|
+
/** Union of loaded kit and loaded apparatus. */
|
|
27
|
+
export type LoadedPlugin = LoadedKit | LoadedApparatus;
|
|
28
|
+
/**
|
|
29
|
+
* Startup context passed to an apparatus's start(ctx).
|
|
30
|
+
*
|
|
31
|
+
* Provides lifecycle-event subscription — the only capability that is
|
|
32
|
+
* meaningful only during startup. All other guild access (apparatus APIs,
|
|
33
|
+
* config, home path, loaded plugins) goes through the `guild()` singleton,
|
|
34
|
+
* which is available during start() and in all handlers.
|
|
35
|
+
*
|
|
36
|
+
* See: docs/architecture/plugins.md
|
|
37
|
+
*/
|
|
38
|
+
export interface StartupContext {
|
|
39
|
+
/** Subscribe to a guild lifecycle event. Handlers may be async; run sequentially. */
|
|
40
|
+
on(event: string, handler: (...args: unknown[]) => void | Promise<void>): void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A kit — passive package contributing capabilities to consuming apparatuses.
|
|
44
|
+
* Open record: contribution fields (engines, relays, tools, etc.) are defined
|
|
45
|
+
* by the apparatus packages that consume them. `requires` and `recommends` are
|
|
46
|
+
* the only framework-level fields.
|
|
47
|
+
*
|
|
48
|
+
* `requires`: apparatus names whose runtime APIs this kit's contributions depend
|
|
49
|
+
* on at handler invocation time. Hard startup validation failure if a declared
|
|
50
|
+
* apparatus is not installed.
|
|
51
|
+
*
|
|
52
|
+
* `recommends`: advisory apparatus names — generates startup warnings when
|
|
53
|
+
* expected apparatuses are absent. Not enforced.
|
|
54
|
+
*/
|
|
55
|
+
export type Kit = {
|
|
56
|
+
requires?: string[];
|
|
57
|
+
recommends?: string[];
|
|
58
|
+
[key: string]: unknown;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* An apparatus — package contributing persistent running infrastructure.
|
|
62
|
+
* Has a start/stop lifecycle. Receives StartupContext at start.
|
|
63
|
+
*
|
|
64
|
+
* `requires`: apparatus names that must be started before this apparatus's
|
|
65
|
+
* start() runs. Determines start ordering. Hard startup validation failure
|
|
66
|
+
* if a declared apparatus is not installed.
|
|
67
|
+
*
|
|
68
|
+
* `recommends`: advisory apparatus names — generates startup warnings when
|
|
69
|
+
* expected apparatuses are absent. Not enforced — the apparatus starts
|
|
70
|
+
* regardless. Use for soft dependencies needed by optional API methods
|
|
71
|
+
* (e.g. The Animator recommends The Loom for summon(), but animate()
|
|
72
|
+
* works without it).
|
|
73
|
+
*
|
|
74
|
+
* `provides`: the runtime API object this apparatus exposes to other plugins.
|
|
75
|
+
* Retrieved via guild().apparatus<T>(name). Created at manifest-definition time,
|
|
76
|
+
* populated during start.
|
|
77
|
+
*
|
|
78
|
+
* `supportKit`: kit contributions this apparatus exposes to consuming apparatuses.
|
|
79
|
+
* Treated identically to standalone kit contributions by consumers.
|
|
80
|
+
*
|
|
81
|
+
* `consumes`: kit contribution field types this apparatus scans for and registers.
|
|
82
|
+
* Enables framework startup warnings when kits contribute types with no consumer.
|
|
83
|
+
*/
|
|
84
|
+
export type Apparatus = {
|
|
85
|
+
requires?: string[];
|
|
86
|
+
recommends?: string[];
|
|
87
|
+
provides?: unknown;
|
|
88
|
+
start: (ctx: StartupContext) => void | Promise<void>;
|
|
89
|
+
stop?: () => void | Promise<void>;
|
|
90
|
+
supportKit?: Kit;
|
|
91
|
+
consumes?: string[];
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* The discriminated union plugin type. A plugin is either a kit or an apparatus.
|
|
95
|
+
* The plugin name is always inferred from the npm package name at load time —
|
|
96
|
+
* it is never declared in the manifest.
|
|
97
|
+
*/
|
|
98
|
+
export type Plugin = {
|
|
99
|
+
kit: Kit;
|
|
100
|
+
} | {
|
|
101
|
+
apparatus: Apparatus;
|
|
102
|
+
};
|
|
103
|
+
/** Type guard: is this value a kit plugin export? */
|
|
104
|
+
export declare function isKit(obj: unknown): obj is {
|
|
105
|
+
kit: Kit;
|
|
106
|
+
};
|
|
107
|
+
/** Type guard: is this value an apparatus plugin export? */
|
|
108
|
+
export declare function isApparatus(obj: unknown): obj is {
|
|
109
|
+
apparatus: Apparatus;
|
|
110
|
+
};
|
|
111
|
+
/** Type guard: narrows a LoadedPlugin to LoadedKit. */
|
|
112
|
+
export declare function isLoadedKit(p: LoadedPlugin): p is LoadedKit;
|
|
113
|
+
/** Type guard: narrows a LoadedPlugin to LoadedApparatus. */
|
|
114
|
+
export declare function isLoadedApparatus(p: LoadedPlugin): p is LoadedApparatus;
|
|
115
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,6CAA6C;AAC7C,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,EAAE,EAAW,MAAM,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAM,MAAM,CAAA;IAC5B,QAAQ,CAAC,GAAG,EAAU,GAAG,CAAA;CAC1B;AAED,oDAAoD;AACpD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,EAAE,EAAW,MAAM,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAM,MAAM,CAAA;IAC5B,QAAQ,CAAC,SAAS,EAAI,SAAS,CAAA;CAChC;AAED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AAG,GAAG,IAAI;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,CAWzE;AAED,uDAAuD;AACvD,wBAAgB,WAAW,CAAC,CAAC,EAAE,YAAY,GAAG,CAAC,IAAI,SAAS,CAE3D;AAED,6DAA6D;AAC7D,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,YAAY,GAAG,CAAC,IAAI,eAAe,CAEvE"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin system — core types for the Kit/Apparatus model.
|
|
3
|
+
*
|
|
4
|
+
* Plugins come in two kinds:
|
|
5
|
+
* - Kit: passive package contributing capabilities to consuming apparatuses.
|
|
6
|
+
* No lifecycle, no running state. Read at load time.
|
|
7
|
+
* - Apparatus: package contributing persistent running infrastructure.
|
|
8
|
+
* Has a start/stop lifecycle. Receives StartupContext at start.
|
|
9
|
+
*
|
|
10
|
+
* See: docs/architecture/plugins.md
|
|
11
|
+
*/
|
|
12
|
+
// ── Type guards ────────────────────────────────────────────────────────
|
|
13
|
+
/** Type guard: is this value a kit plugin export? */
|
|
14
|
+
export function isKit(obj) {
|
|
15
|
+
return (typeof obj === 'object' &&
|
|
16
|
+
obj !== null &&
|
|
17
|
+
'kit' in obj &&
|
|
18
|
+
typeof obj.kit === 'object' &&
|
|
19
|
+
obj.kit !== null &&
|
|
20
|
+
!Array.isArray(obj.kit));
|
|
21
|
+
}
|
|
22
|
+
/** Type guard: is this value an apparatus plugin export? */
|
|
23
|
+
export function isApparatus(obj) {
|
|
24
|
+
return (typeof obj === 'object' &&
|
|
25
|
+
obj !== null &&
|
|
26
|
+
'apparatus' in obj &&
|
|
27
|
+
typeof obj.apparatus === 'object' &&
|
|
28
|
+
obj.apparatus !== null &&
|
|
29
|
+
typeof (obj.apparatus.start) === 'function');
|
|
30
|
+
}
|
|
31
|
+
/** Type guard: narrows a LoadedPlugin to LoadedKit. */
|
|
32
|
+
export function isLoadedKit(p) {
|
|
33
|
+
return 'kit' in p;
|
|
34
|
+
}
|
|
35
|
+
/** Type guard: narrows a LoadedPlugin to LoadedApparatus. */
|
|
36
|
+
export function isLoadedApparatus(p) {
|
|
37
|
+
return 'apparatus' in p;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA4GH,0EAA0E;AAE1E,qDAAqD;AACrD,MAAM,UAAU,KAAK,CAAC,GAAY;IAChC,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACZ,KAAK,IAAI,GAAG;QACZ,OAAQ,GAAwB,CAAC,GAAG,KAAK,QAAQ;QAChD,GAAwB,CAAC,GAAG,KAAK,IAAI;QACtC,CAAC,KAAK,CAAC,OAAO,CAAE,GAAwB,CAAC,GAAG,CAAC,CAC9C,CAAA;AACH,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACZ,WAAW,IAAI,GAAG;QAClB,OAAQ,GAA8B,CAAC,SAAS,KAAK,QAAQ;QAC5D,GAA8B,CAAC,SAAS,KAAK,IAAI;QAClD,OAAO,CACJ,GAA8C,CAAC,SAAS,CAAC,KAAK,CAChE,KAAK,UAAU,CACjB,CAAA;AACH,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,WAAW,CAAC,CAAe;IACzC,OAAO,KAAK,IAAI,CAAC,CAAA;AACnB,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,iBAAiB,CAAC,CAAe;IAC/C,OAAO,WAAW,IAAI,CAAC,CAAA;AACzB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package resolution utilities for guild-installed npm packages.
|
|
3
|
+
*
|
|
4
|
+
* Resolves entry points from the guild's node_modules by reading package.json
|
|
5
|
+
* exports maps directly. Needed because guild plugins are ESM-only packages
|
|
6
|
+
* and createRequire() can't resolve their exports.
|
|
7
|
+
*
|
|
8
|
+
* Also owns:
|
|
9
|
+
* - derivePluginId — canonical npm package name → plugin id derivation
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Derive the guild-facing plugin id from an npm package name.
|
|
13
|
+
*
|
|
14
|
+
* Convention:
|
|
15
|
+
* - `@shardworks/nexus-ledger` → `nexus-ledger` (official scope stripped)
|
|
16
|
+
* - `@shardworks/books-apparatus` → `books` (descriptor suffix stripped)
|
|
17
|
+
* - `@acme/my-plugin` → `acme/my-plugin` (third-party: drop @ only)
|
|
18
|
+
* - `my-relay-kit` → `my-relay` (descriptor suffix stripped)
|
|
19
|
+
* - `my-plugin` → `my-plugin` (unscoped: unchanged)
|
|
20
|
+
*
|
|
21
|
+
* The `@shardworks` scope is the official Nexus namespace — its plugins are
|
|
22
|
+
* referenced by bare name in guild.json, CLI commands, and config keys.
|
|
23
|
+
* Third-party scoped packages retain the scope as a prefix (without @) to
|
|
24
|
+
* prevent collisions between `@acme/foo` and `@other/foo`.
|
|
25
|
+
*
|
|
26
|
+
* Descriptor suffixes (`-plugin`, `-apparatus`, `-kit`) are stripped after
|
|
27
|
+
* scope resolution so that package naming conventions don't leak into ids.
|
|
28
|
+
*/
|
|
29
|
+
export declare function derivePluginId(packageName: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Read a package.json from the guild's node_modules.
|
|
32
|
+
* Returns the parsed JSON and version. Falls back gracefully.
|
|
33
|
+
*/
|
|
34
|
+
export declare function readGuildPackageJson(guildRoot: string, pkgName: string): {
|
|
35
|
+
version: string;
|
|
36
|
+
pkgJson: Record<string, unknown> | null;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Resolve the npm package name for a plugin id by consulting the guild's root package.json.
|
|
40
|
+
*
|
|
41
|
+
* Scans all dependencies and runs `derivePluginId()` on each to find the
|
|
42
|
+
* package whose derived id matches. This correctly handles descriptor
|
|
43
|
+
* suffixes (-kit, -apparatus, -plugin) that derivePluginId strips.
|
|
44
|
+
*
|
|
45
|
+
* When multiple packages derive to the same id (unlikely but possible),
|
|
46
|
+
* prefers @shardworks-scoped packages over third-party ones.
|
|
47
|
+
*
|
|
48
|
+
* Returns null if no matching dependency is found.
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolvePackageNameForPluginId(guildRoot: string, pluginId: string): string | null;
|
|
51
|
+
/**
|
|
52
|
+
* Resolve the entry point for a guild-installed package.
|
|
53
|
+
*
|
|
54
|
+
* Reads the package's exports map to find the ESM entry point.
|
|
55
|
+
* Returns an absolute path suitable for dynamic import().
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveGuildPackageEntry(guildRoot: string, pkgName: string): string;
|
|
58
|
+
//# sourceMappingURL=resolve-package.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-package.d.ts","sourceRoot":"","sources":["../src/resolve-package.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAY1D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CAAE,CAQ9D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAoBhG;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAmBnF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package resolution utilities for guild-installed npm packages.
|
|
3
|
+
*
|
|
4
|
+
* Resolves entry points from the guild's node_modules by reading package.json
|
|
5
|
+
* exports maps directly. Needed because guild plugins are ESM-only packages
|
|
6
|
+
* and createRequire() can't resolve their exports.
|
|
7
|
+
*
|
|
8
|
+
* Also owns:
|
|
9
|
+
* - derivePluginId — canonical npm package name → plugin id derivation
|
|
10
|
+
*/
|
|
11
|
+
import fs from 'node:fs';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
/**
|
|
14
|
+
* Derive the guild-facing plugin id from an npm package name.
|
|
15
|
+
*
|
|
16
|
+
* Convention:
|
|
17
|
+
* - `@shardworks/nexus-ledger` → `nexus-ledger` (official scope stripped)
|
|
18
|
+
* - `@shardworks/books-apparatus` → `books` (descriptor suffix stripped)
|
|
19
|
+
* - `@acme/my-plugin` → `acme/my-plugin` (third-party: drop @ only)
|
|
20
|
+
* - `my-relay-kit` → `my-relay` (descriptor suffix stripped)
|
|
21
|
+
* - `my-plugin` → `my-plugin` (unscoped: unchanged)
|
|
22
|
+
*
|
|
23
|
+
* The `@shardworks` scope is the official Nexus namespace — its plugins are
|
|
24
|
+
* referenced by bare name in guild.json, CLI commands, and config keys.
|
|
25
|
+
* Third-party scoped packages retain the scope as a prefix (without @) to
|
|
26
|
+
* prevent collisions between `@acme/foo` and `@other/foo`.
|
|
27
|
+
*
|
|
28
|
+
* Descriptor suffixes (`-plugin`, `-apparatus`, `-kit`) are stripped after
|
|
29
|
+
* scope resolution so that package naming conventions don't leak into ids.
|
|
30
|
+
*/
|
|
31
|
+
export function derivePluginId(packageName) {
|
|
32
|
+
// Step 1: strip scope
|
|
33
|
+
let name;
|
|
34
|
+
if (packageName.startsWith('@shardworks/')) {
|
|
35
|
+
name = packageName.slice('@shardworks/'.length);
|
|
36
|
+
}
|
|
37
|
+
else if (packageName.startsWith('@')) {
|
|
38
|
+
name = packageName.slice(1); // @acme/foo → acme/foo
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
name = packageName;
|
|
42
|
+
}
|
|
43
|
+
// Step 2: strip descriptor suffix
|
|
44
|
+
return name.replace(/-(plugin|apparatus|kit)$/, '');
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Read a package.json from the guild's node_modules.
|
|
48
|
+
* Returns the parsed JSON and version. Falls back gracefully.
|
|
49
|
+
*/
|
|
50
|
+
export function readGuildPackageJson(guildRoot, pkgName) {
|
|
51
|
+
const pkgJsonPath = path.join(guildRoot, 'node_modules', pkgName, 'package.json');
|
|
52
|
+
try {
|
|
53
|
+
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
|
|
54
|
+
return { version: pkgJson.version ?? 'unknown', pkgJson };
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return { version: 'unknown', pkgJson: null };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Resolve the npm package name for a plugin id by consulting the guild's root package.json.
|
|
62
|
+
*
|
|
63
|
+
* Scans all dependencies and runs `derivePluginId()` on each to find the
|
|
64
|
+
* package whose derived id matches. This correctly handles descriptor
|
|
65
|
+
* suffixes (-kit, -apparatus, -plugin) that derivePluginId strips.
|
|
66
|
+
*
|
|
67
|
+
* When multiple packages derive to the same id (unlikely but possible),
|
|
68
|
+
* prefers @shardworks-scoped packages over third-party ones.
|
|
69
|
+
*
|
|
70
|
+
* Returns null if no matching dependency is found.
|
|
71
|
+
*/
|
|
72
|
+
export function resolvePackageNameForPluginId(guildRoot, pluginId) {
|
|
73
|
+
const pkgPath = path.join(guildRoot, 'package.json');
|
|
74
|
+
let deps = [];
|
|
75
|
+
try {
|
|
76
|
+
const pkgJson = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
77
|
+
deps = Object.keys(pkgJson.dependencies ?? {});
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
let match = null;
|
|
83
|
+
for (const dep of deps) {
|
|
84
|
+
if (derivePluginId(dep) === pluginId) {
|
|
85
|
+
// Prefer @shardworks-scoped packages (official namespace)
|
|
86
|
+
if (dep.startsWith('@shardworks/'))
|
|
87
|
+
return dep;
|
|
88
|
+
// Keep the first match as fallback
|
|
89
|
+
if (!match)
|
|
90
|
+
match = dep;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return match;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Resolve the entry point for a guild-installed package.
|
|
97
|
+
*
|
|
98
|
+
* Reads the package's exports map to find the ESM entry point.
|
|
99
|
+
* Returns an absolute path suitable for dynamic import().
|
|
100
|
+
*/
|
|
101
|
+
export function resolveGuildPackageEntry(guildRoot, pkgName) {
|
|
102
|
+
const pkgDir = path.join(guildRoot, 'node_modules', pkgName);
|
|
103
|
+
const { pkgJson } = readGuildPackageJson(guildRoot, pkgName);
|
|
104
|
+
if (pkgJson) {
|
|
105
|
+
const exports = pkgJson.exports;
|
|
106
|
+
if (exports) {
|
|
107
|
+
if (typeof exports === 'string')
|
|
108
|
+
return path.join(pkgDir, exports);
|
|
109
|
+
const main = exports['.'];
|
|
110
|
+
if (typeof main === 'string')
|
|
111
|
+
return path.join(pkgDir, main);
|
|
112
|
+
if (main && typeof main === 'object') {
|
|
113
|
+
const importPath = main.import;
|
|
114
|
+
if (importPath)
|
|
115
|
+
return path.join(pkgDir, importPath);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (pkgJson.main)
|
|
119
|
+
return path.join(pkgDir, pkgJson.main);
|
|
120
|
+
}
|
|
121
|
+
return path.join(pkgDir, 'index.js');
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=resolve-package.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-package.js","sourceRoot":"","sources":["../src/resolve-package.ts"],"names":[],"mappings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C,GAAG,CAAC,CAAC;YACvD,IAAI,OAAO,IAAI,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC7D,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACrC,MAAM,UAAU,GAAI,IAA+B,CAAC,MAAM,CAAC;gBAC3D,IAAI,UAAU;oBAAE,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;QACD,IAAI,OAAO,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,IAAc,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AACvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,35 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shardworks/nexus-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.101",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/shardworks/nexus",
|
|
8
|
-
"directory": "packages/core"
|
|
8
|
+
"directory": "packages/framework/core"
|
|
9
9
|
},
|
|
10
|
-
"description": "Nexus core
|
|
10
|
+
"description": "Nexus core — public SDK surface: guild singleton, plugin/kit/apparatus types, guild config, package resolution",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
15
|
"import": "./dist/index.js"
|
|
16
|
-
},
|
|
17
|
-
"./legacy/1": {
|
|
18
|
-
"types": "./dist/legacy/1/index.d.ts",
|
|
19
|
-
"import": "./dist/legacy/1/index.js"
|
|
20
16
|
}
|
|
21
17
|
},
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"better-sqlite3": "12.8.0",
|
|
24
|
-
"zod": "4.3.6"
|
|
25
|
-
},
|
|
18
|
+
"dependencies": {},
|
|
26
19
|
"devDependencies": {
|
|
27
|
-
"@types/better-sqlite3": "7.6.13",
|
|
28
20
|
"@types/node": "25.5.0"
|
|
29
21
|
},
|
|
30
22
|
"files": [
|
|
31
|
-
"dist"
|
|
32
|
-
"migrations"
|
|
23
|
+
"dist"
|
|
33
24
|
],
|
|
34
25
|
"scripts": {
|
|
35
26
|
"build": "tsc",
|