PerryLink/dsh-os--packages-contract ↗★ 1

@perrylink/dsh-os-contract

Canonical service names, capabilities, error codes, refs, result/error/audit protocol helpers and thin validators shared by dsh-os modules.

Package
@perrylink/dsh-os-contract
Compatibility
Unverified
Version
0.2.0
License
MIT
Last updated
Nov 21, 2026

Install

This plugin has no verified bundle, or compatibility checks failed. Read the repository notes first. Read the full README ↗

Usage

import {
  CAPABILITIES,
  ERROR_CODES,
  SERVICES,
  assertManifest,
  defineTool,
  isOsObject,
  makeRef,
  parseRef,
} from '@perrylink/dsh-os-contract'

SERVICES.trigger // 'triggers' → the module provides ctx.triggers
CAPABILITIES[0] // 'fs.read'
ERROR_CODES.E_NOT_FOUND // 'E_NOT_FOUND'

makeRef('memory', 'm-1') // 'dsh://memory/m-1'
parseRef('dsh://memory/m-1') // { kind: 'memory', id: 'm-1' }

isOsObject({ id: 'm-1', createdAt: Date.now() }) // true

assertManifest(pkg) // returns pkg, or throws E_INVALID_ARGUMENT

const tool = defineTool({
  name: 'snip_search',
  description: 'Search snippets.',
  parameters: { type: 'object', additionalProperties: false, properties: {} },
  output: {
    schema: { type: 'object', additionalProperties: true },
    render: (_args, value) => [{ type: 'text', text: JSON.stringify(value) }],
  },
  async execute(args) {
    return { items: [] }
  },
})